Why C++ is superior to Python, Java and C#


On the first look, C/C++ is a complicated language, mostly because of the pointer syntax and because every programmers has it’s own programming style. In contrast, the Python syntax is much more cleaner and provides beginner a good platform for programming prototypes, while C# is a good tool for programming real applications which has to be run fast. So, is C++ perhaps outdated?

No it is not, because the assumption that Python is easier to learn is a misconception. Let us first introduce a concept which improves the productivity of a programmer more then any other concept, it is called “operating system library”. The reason why today games can be programmed by a single person on a single day while in the 1980s this wasn’t possible has to do with out of box libraries which are available today. A well implemented library like SFML allows the programmer to program a 2d jump’n’run game including a game logic, animated sprites and a sound, without writing too much complicated code. And a library for parsing PDF allows the programmer to realize a GUI application also without much effort.

The number one question in programming is not about the perfect programming language with the cleaner syntax, it is about access to existing libraries and writing new libraries for future use. Without any doubt, C/C++ is the best programming language for programming libraries. It is used by Linux, Mac OS and Windows all the time, and there is no alternative out there. Sure, in theory it is possible to write an operating system in Java or in Python, but the reality is, that this is not done, because an operating system has to be fast, and needs access to the hardware.

Sure it is possible to use Python sourcecode for accessing a C/C++ library. But it is not able to replace C/C++ with python, because somebody has to create the library first. If no library is there, Python programmers are not able to create one from scratch. Because writing a library needs lot of lines of code. The main problem with today’s C++ ecosystem is not the language itself, but a lack of libraries. That means, not the C++ syntax is complicated, but the libraries are which are not providing all the features the user need. For example, SFML doesn’t provide 3D access. And as a result, using SFML is complicated. A switch from C++ to Python or C# will not improve the situation, because the working of a library has to with the API it provides, not with the language syntax.

The way to future computing is organized around better libraries. If the library gets a cleaner API, it can be used easier by the programmer, no matter which language he prefers. And C/C++ is the answer for writing better libraries. It is some kind of standard programming language for that task. Any operating system is written in C/C++ and libraries are part of the operating system. That means, existing problems in C++ can’t be solved by a different programming language, they can only be solved within the C/C++ ecosystem.

Python, C# and Java have the problem, that they didn’t understand this concept. They believe, that programming in C++ is too complicated and that they can provide help for the enduser. On the short hand, they are true. A gui application written in Python is easier to program then a GUI application in C++. But what will happen, if all the programmers will switch from C++ away to Python? Right, nobody is there for improving the libraries and this will result into much more problems, then Python can solve. In the software ecosystem is only one bottleneck available: the libraries written in C++. If somebody improves the quality there he will raise up the standard for all operating systems, all programming languages and all sort of software. Criticizing C/C++ as the wrong language is not a contribution to that goal, but a statement to ignore the problems. C# programmers have give up to write better software. They are simply doing their own business and are no longer work together with other programmers on the overall project. The same is true for Go programmers, Rust programmers and all the other C/C++ replacements available today. It the energy which was invested into writing go libraries from scratch would be redirected into improving existing C/C++ libraries the software quality would be greater today.

Perhaps some numbers

If a game engine was used a simple game can be realized in 500 lines of code. In which language the code was written isn’t very important. Python has the cleanest syntax, but C/C++ code is also readable. The problem is not, if the code contains some pointers or a complicated syntax, the only problem is, if the lines of code will raise from 500 to 5000 because the absence of a library. That will kill the productivity drastically.

Python was invented as a high productivity language. And C# was invented as a pointer-free language. What the language developers has forget to tell is, that the productity is based on the existence of C/C++ library. Without lowlevel C libraries for getting access to the graphic card, the harddrive and the soundcard, Python and C# are nothing. Without a library in the background, the language can’t even put a simple hello world to the screen. What so called high-level-language didn’t have understood is, that not their clean syntax will raise the productivity, but the fact they run on top of existing operating system APIs. Pushing the existing productivity to new highs can’t be done with high-level scripting languages, it can only be done with better C/C++ libraries. And teaching the students how to program in Python doesn’t provide the knowledge in writing better C++ libraries. So it is the wrong way in computer science curriculum. If the students are honest to themself, they know that Python is wrong. It makes no sense to invent a second language only for getting easier access to the C language. If somebody is interested in bringing C forward, he can improve existing compilers and write new c interpreters from scratch but please: do not invent another programming language.which is easier to use then C/C++.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.