Why C++ in 2017 ?

What are the advantages of making software with C/C++ in 2017 ? The question is simple. But the response is extraordinary powerful. Let me explain...

If you are on the server, you want performance... You don't want to distribute a huge framework and cross too many layers. If you have the socket handler, you make the process and you use the socket back. It's fast, it's powerful. Look at the casablanca library, it is built for that. You have REST support and it's build to be easy to use it. Looking for an existing HTTP server ? Just explore the source code of NGINX. Another ? Look at lighttpd, it's small, it is fast. On the server, you achieve more than any other language and your are close to the CPU, very close if you use optimized code or low level processor extensions API.

On the Linux land, everything (in my opinion 98%) is done using C and C++. You can download the source code of your favorites applications. It's a fabulous way to discover all the magic of theses softwares.

If you are on the mobile, you need to manage the battery, the memory and manage resources in general. Here, the king is C/C++. You allocate the number of bytes you need, you create threads to gain extra power and you are responsible to free resources you use. If you need to process data like image or video or music, the signal stuff must be written in native code and this is the only solution.

Let's talk about databases or database engines files based like MySQL or Codebase, you have a C source code base. You build it on your platform and you can gain access to this marvelous engines. You build upon your operating system, there is nothing closest than that. Next stop is registers and code optimizations. Your compiler can handle it alone, it's just a matter of compiler flags.

On the desktop land, it's simple: can you run your application on Windows XP, Vista, Seven, Windows 8.x and Windows 10 ? Some of yours would say "may be, may be not". In C++, you can. No framework to distribute. Just the vcredist.exe magic stuff. 10 MB.

C++ applications means superiority in CPU usage, memory management and lower battery utilization : it's a fact. It's part of the deal. It runs fast by default.

In the C++ world we don't create a class witch contains 5 methods and 2 fields like in Java or C#. We do more. A lot more. Our class are consequent and take a lot of stuff inside because it is interesting to have a project with 10 files of 100 KB rather than 300 files of 3 KB organized with fuzzy concepts. We do OOP better. It's more compact, it's real, it just works.

In C++, we have the feature of the templates. It's superior to C# generic and it's used differently. The STL is the Standard Template Library, it's made with templates. The std::string is made with it, the vector<T> is made with it, it's magic and efficient. We support multi-inheritance. We don't create interfaces when it's not necessary. C++ coding is the superior form of coding for OOP compared to productive language like Java or C#.

Comments (6)

  1. Leonardo says:

    I not agree with you, OOP is done better with C# like languages where classes are first citizen

  2. Fred Armoni says:

    i’d add this, C++ code does what it was built for, no more gadget inn and this is a big part of the difference…

  3. 0xmarcin says:

    I just cannot persuade myself that you can write business application in C++ in 2017. I understand that in some small domains like High frequency trading C++ may give you advantage, but from enterprise developer point of view performance is not that much important. If you want speed write your application in such a way that it allows horizontal scaling and let cloud infrastructure take care of the performance. Besides that C++ has poor tooling compared to C#/Java, using libraries is cumbersome (no nuget there), there are problems like memory leaks and memory fragmentation (smart pointers won’t help here), to name just a few. BTW on Linux plenty of GUI apps are written in Python – just because wrangling with C++ and GUI – the old way would take too much time. The last argument that I can add is Android – you may argue that this is the platform that needs performance and raw power of C++ the most – but again Java was choosen as the platform language – I guess because dev productivity is more important than raw power…

  4. EnCey says:

    So what you’re saying is basically “Me C++ programmer, C++ is best superior because it’s C++, everything else sucks”.
    I could write a similar post about why VIM is clearly better and superior to Visual Studio, because it has several registers for copy/paste, you can repeat commands etc. and not look at what the other has to offer. Because why would I, it’s VIM and I know it and clearly it’s superior.

    Sure you can write asynchronous C++ server apps in 3,5 years or do the same in C# in 2 weeks. Sure the C++ version will be 15% faster and consume 32% less memory, but my quad-core server with 16GB RAM doesn’t really care whether it has to run this 10MB app or this 13MB app.
    The time saved in developing the app, fixing bugs and maintaining it on the other hand does matter.

    I know the same does not apply to the <1% of people that have to write actual hard-core performance critical applications, but the rest of the world does well enough with C#.

  5. patrick leller says:

    Keep telling yourself that. Sure for raw performance can’t beat C/C++ but for backend enterprise apps nothing wrong with C#/Java. Multi-inheritance is nasty, if you need that your design is off.

  6. Funbit says:

    Can’t believe to see such an article in Microsoft blog :\

Skip to main content