June 02, 2022

Why Forth is better than Python

 

There is some sort of ongoing debate available which of the programming languages is more compact and which runs more efficient. Of course, the winner is Forth because this stack based language is the preferred choice of elite programmers. It needs only a small amount of RAM and can be executed an any computer including the Commodore 64.
To get a better understanding why exactly ANSI Forth is more than ready for creating large projects including video games, we have to compare the sourcecode for the game of Tetris. Both projects were created by different programmers in the past and perhaps they doesn't aware of each other.
The first one was written in a Forth dialect and compiles out of the box under Linux and Windows as well. It needs only 384 lines of code and the bricks patterns were encoded in a very elegant way. In addition, the source code was factored well in subroutines so that the overall program is easy to understand.
In contrast, the same game of Tetris which was implemented in the Python language needs around 134 lines of code. The code is hard to understand and most operating systems aren't able to run the code because it was written for a certain python version which includes unknown libraries likes tkinter. The programmer has created a mess of methods which are distributed over classes and stand alone routines and it is hard to maintain the code.
Everybody is encouraged to compare the Python and the Forth language by itself. So there is no need to follow my judgment.

No comments:

Post a Comment