Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am intending to purchase some source code for my Delphi program. It is not too big an algorithm, but it is not available in Delphi and I'll have to translate it to Delphi.

However, I have not worked in any of the languages it is offered in and I don't know which I should buy. I want the one that will translate to Delphi most easily and accurately.

The three languages are: C++, Java, and C#.

Which one would be easiest to convert?


migration rejected from Jun 16 '13 at 10:06

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as not constructive by gnat, MichaelT, Dynamic, Martijn Pieters, ChrisF Jun 16 '13 at 10:06

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

This may not assist you, but C# was designed by the same person who designed Delphi (Anders Hejlsberg). – Gabe Jun 6 '11 at 0:35
And he quit developing Delphi a long time ago. – Seth Carnegie Jun 6 '11 at 0:37
Knowing nothing of Delphi, I think I'd pick C#. C++ can have some serious black magic and Java feels very verbose for common tasks. I'd think the algorithm would stand out clearest in C#. – sarnold Jun 6 '11 at 0:38
@Seth, your actual experience in this matter definitely counts for a lot :) I'm just saying I'd rather learn an algorithm from C# than C++ or Java. If the code can be more mechanically converted, so much the better; but I wouldn't necessarily want to reproduce some of the darker corners of C++-based code elsewhere if I could avoid it. – sarnold Jun 6 '11 at 0:45
Without seeing the code it's impossible to say which one will be easier to modify. Probably, the efforts will be the same because it's unlikely the said library is written individually using the best facilities each language offers. Such (multilanguage) libraries are typically written for the lowest common denominator and just replicated to other languages. In this case Java is the lowest denominator and other versions may differ only syntactically. – Gene Bushuyev Jun 6 '11 at 4:07
up vote 4 down vote accepted

I don't really have an answer about converting, but given that it's the Metaphone algorithm you want to purchase, I wanted to make sure you're aware that there is already an implementation for Delphi:

Even if for some reason the commercial version is preferable and you want to port it to Delphi, it would probably help to compare the other language's implementation to the Metaphone already available for Delphi.

This is the third version of the Metaphone algorithm by the same author that I'm looking at. This version is not free. – lkessler Jun 7 '11 at 4:02
@kessler -- The version is free but is under the GPL, which may not work if you have a commercial product. There are other totally free versions in Delphi that you have probably found. In any case, it's not a huge algorithm and porting from c++/c#/java should not be huge deal. I suspect the c# version would be most direct. Why not offer to sell your work back to the vendor so they can potentially profit from offering new language version? Maybe they wouldn't pay you, but instead would offer you all three of their versions for free. – Herbert Sitz Jun 7 '11 at 15:35

Your best bet is a free Java 2 Pascal convertor. There is also free C# to Oxygene convertor, which is actually a convertor to Prism (which is pretty close to Delphi Pascal language).

In both cases don't expect converting a full application, but rough converting of units and then using parts in your code will work with some manual corrections.

These both sound interesting as alternatives. – Warren P Jun 12 '11 at 3:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.