October 25, 2021

Why do people reject C++?

 

C++ is known as a complicated to use but powerful programming language. Lots of tutorials were created around the ecosystem and many programmers are explaining to the newbies that C++ is difficult to learn. But what exactly means difficult?
The only thing what a newbies should learn is to make things more comfortable. A good starting point is to use the command #include<myclass.cpp> at the beginning. This allows to put the classes in different files without creating header files. The second step to become a c++ expert is to ignore the so called heap memory at all but put all the class instances on the stack frame. This allows to avoid the pointer syntax and the code will look very clean. In addition the auto keyword can be used and the resulting c++ code has much in common with java and python.
The interesting situation is that it is pretty easy to create in the C++ language games, GUI applications or backend software. If the user finds out a difficult problem it is for sure that stackoverflow knows the answer already. Admitted, C++ is more complicated to program than Python. But suppose a python interpreter isn't available and C++ is the only language available. Then it is a reasonable well language which fits most needs.
The amount of existing c++ books, github projects and stackoverflow questions is high so the perception is that C++ is the opposite of a difficult to learn language. Using C++ for creating standard applications is like walking on a way which was used by many thousands before. It is not possible that the user will struggle by implementing the projects he wants. And object oriented programming makes it easy to create large projects.
The real problem with C++ is that similar to potential alternatives like C# or PHP the productivity of programmers are limited. That means even experts are not able to write more than 10 lines of code per day and they are failing in creating entire operating systems by their own. So the only sense making projects for a newbie is to create small programs for example a prime number generator or a pong clone.