Porting Java code to C++ or Python

Asked

Viewed 290 times

-1

I’m working on a project that was originally written in Java.

I want to learn more about the mathematics and the logic behind the code, and I had the idea of porting the code to another language.

I thought about C++ and Python.

Which one has the most similarities and would take less time and effort to translate?

  • 1

    Your question is opinionated, because it goes from the experience and personal opinion of each one. Some will say that C++ will be better and others will say it is Python. There is no clear answer because it depends on personal taste and preference. In addition, time and effort depend heavily on the type of application it is about, how it is organized, and also on your knowledge of C++ and Python.

  • Did the answer solve your problem? Do you think you can accept it? If you don’t know how you do it, check out [tour]. This would help a lot to indicate that the solution was useful to you and to give an indication that there was a satisfactory solution. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

3

I don’t think it’s a good way to get what you want. Math and logic is learned outside of programming languages.

Java is roughly considered an evolution of C++ (I can assure you that no experienced C++ programmer thinks so), so in theory it would be easier to translate to C++ than Python, which has no resemblance to Java, except for the semantics of if (nor the syntax) and anything else. Python has a philosophy absurdly far from Java.

But if you want something similar to Java you should opt for C#. This is a very similar and easier language. C++ is difficult for a beginner who is still struggling to understand the basic difference between languages.

If you do not know any it will be difficult in any one. Then the difficulty is to learn the language. If I tried to learn during the translation, I could achieve neither one thing nor the other.

Anyone will say that Python is easier to learn than C++, but that means nothing.

Anyway you need to decide if you want to learn something or if you want to save time, these things are incompatible (at least in the short term, as described).

Which you should choose I will not answer, but I point out the wrong way.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.