Today, I am going to speak up for C++ and the importance I see it has nowadays. I am going to assume you are fairly familiar with C/C++.

Some people say that learning C++ today is a waste of time and quite useless as we have much more powerful languages such as Java and C#, well I am against that wave. Though I agree that both above mentioned languages have more productivity and are somehow more powerful than C++ I still think that people should learn C++ no matter what.

The reason I think that is that C++ is so permissive and have so many concepts which in higher abstracted languages are invisible for the programmer that any coder should be really familiar with them.
Some other people say it’s just too hard. Well, I am not going to argue it’s easy but once mastered you can jump to other languages in a heartbeat so keep that in mind.

I will not bring up the “speed” argument because as of today both Java and C# are very fast, equally fast to C++ and even faster than C++ in some aspects. Though I have to say that using C++ you will be able to target a specific hardware and make necessary optimizations so that the execution speed would be truly amazing.

And now comes that awful and painful moment(for others not for me) to speak about pointers. Well, pointers are the crown of C++ as most people have a hard time with them and even very experienced programmers get their necks twisted in large programs.
Because of the so permissive C++ compiler and the manual memory management pointers have given programmers lots of headaches. There are advantages and disadvantages of pointers and just to be clear you don’t have to deal with them in C# or Java for that manner.

As I previously said, Java and C# are more productive due to their huge libraries. You can do complex things with just a few lines of code whereas in C++ the same effect would need a up to 10x more code lines, but some things are harder to code in Java or C# than in C++. Here are some examples I could find:

  1. Generics are not as powerful as templates (try to write an efficient generic Parse method (from string to T), or an efficient equivalent of boost::lexical_cast in C# to understand the problem)
  2. RAII remains unmatched (GC still can leak (yes, I had to handle that problem) and will only handle memory. Even C#’s using is not as easy and powerful because writing a correct Dispose implementations is difficult)
  3. C# readonly and Java final are nowhere as useful as C++’s const(*) (There’s no way you can expose readonly complex data (a Tree of Nodes, for example) in C# without tremendous work, while it’s a built-in feature of C++. Immutable data is an interesting solution, but not everything can be made immutable, so it’s not even enough, by far).

Of course if you want to develop end users apps with GUI probably C# WPF or JAVA Swing is the the way you want to do it though C++ also offer the QT library, however it’s less intuitive and fun than the other two.
For servers, C++ is still the best bet because there every millisecond counts and you really need to max out the performance.

So why do I recommend people to get started with C++ and master it:

  • because it’s helping you thinking of optimizations
  • it’s sometimes faster
  • pointers – we love them !!
  • understanding of low level PC arhitecture

It’s much easier for someone to switch languages if you know how data is represented in hardware and how things are going “under the hood” and as I always say use the right tool(PL) for the right job, you should not be restricted by a programming language when you have to solve a task.

There is also the matter of static compiler vs JIT about which you can read about here.
You can also find more opinions on this matter
here.

So maybe C++ is old and “not cool” but is still alive and kicking (pretty hard if you ask me) and you should get a few keyboard smashed before going up for some of the more enjoyable languages out there.
PS: There are probably more things to say on this topic so feel free to share!

Simple Share Buttons