September 24, 2019

Comparison of Python with Java

Java and Python are both alternatives to the C/C++ ecosystem. The idea is to create software with the object oriented paradigm but avoid complicated pointer arithmetic and outdated package manager. What Java have in common with the C/C++ standard is, that the programmer has to enter variable types like integer, boolean and arraylist. In the Python language this is no longer needed, instead the variable types are determined on the fly.

This makes Python to a modern language. It simplifies the programming process over Java. That means, the same algorithm can be implemented in less time and with less lines of code. On the other hand, it's harder to program a Python interpreter and a python just in time compiler. Because the interpreter has to figure out by himself if a variable is a character, an integer or a float.

Python is the most high level language available today. That means, the program can focus on the problem but is not forced to think in the problem. The next higher step after python is not programming any line of code but using a package manager to insteall an existing application. That means, the “dnf install pacman-game” command works better, than creating the pacman game in Python from scratch. A look into the usage of Python have shown, that only a few people are aware of the language. Most programmers are prefering classical languages like C, C++, C#, Java and Fortran. In case of C++ they are doing so because of performance reason, and in case of Java because they want to use a just in time compiler which is perceived as more mature, than a Python interpreter which is producing memory leaks.

It make sense to divide the existing programming languages into groups. The first one is compiled vs. interpreted. And the second one is staticaly datatype vs. dynamic scripting languages . For example the Java language is a semi-compiled language which is working with static datatypes. That means, before the user can start a hello world program he needs to run the java compiler. And in the hello world example, the variable i in the for loop has to initialized as an integer type. On the other hand, Python is the most modern language, because no compiler and no datatypes are needed anymore. That means, Python code can be written much faster, than C, Java or C# code.

Python have much in common with other scripting languages like Perl and bash scripts. It was invented as an alterntive to classical programming but has become popular very fast because many non programmers are attracted by the low entry barrier. The difference between using an existing application and write a python script is small. On the other hand, Python is more complicated than using an Excel spreadsheet for calculating numbers. Because the python interpreter needs an error free script before the first run. It won't fix syntax problems by it's own.