Pirx un[blog]ged

Mike is reading four blogs. This is none of them.

In defence of C++

Many is written about the pros and cons of all these programming languages. But after reading this all over the years with great interest, I realized that most articles have a blind spot. Because, yes it's true, that PHP is a mess and Lisp is a mess too. So is C++ not welcomed everywhere. But don't forget one thing: Programmers love there languages despite the limitations and shortcomings. The simple truth is, that a Java-programmer loves Java and a Haskell addict will inject Haskell. There is no way out.

I remember the days when I was part of a great team developing a control system for power plants. The whole team was programming on an VAX system in Pascal. And there was nothing wrong with Pascal. Nevertheless one day I asked the team to code in C. I got the permission and was happy. Another coworker also switched to C. The code reviews revealed that there was nothing better with our code. But I was more productive, because I loved this language. The cause was myself and not a property of the language.

This is one of the blind spots, when we are talking about programming languages. These languages where made from humans for humans and are not an end in themselves. Programming languages are tools. And if you like a specific tool, you will work with this tool, even if your neighbor says it's ugly. Because beauty is in the eye of the beholder. This is also true in technology. And this is the reason why discussions in this question are so emotionally charged. It's like imprinting. There is no objective evidence. It's opinion and perception.

Another blind spot is to ignore, that controlling a (programming) language implies power. A good example is the release of C# by Microsoft at the year 2000. C# was from the beginning nothing more than another curly bracket language. Why didn't Microsoft use the so popular and handy Java Language for their own purposes? The main reason is, that Java was ruled at this time by Sun Microsystems. Eventually Microsoft finished all active participation in Java development and focused solely on the CLR development. And an essential part of that effort was C# as a language tweaked to reveal the full power of this new runtime environment. The true enemy wasn't Java in this case but the Java Runtime. Don't forget this when you think about languages.

There are more blind spots and I've planned to write more on this topic in other posts later. This will be sufficient initially. And now read all these rants again C++ again. Pay particular attention to the fact that C++ is more than one language, it's a federation of languages. You can

  • write C code and compile it with your C++ compiler
  • write OO style
  • use templates with all code in header files only (STL)
  • use libraries to program in functional style
  • extend the language with libraries in any way you want!

I doesn't know any language with this capabilities. But despite all these demanding features the best of all is, that no single company controls evolution of this language. It is the result of combined efforts and it is open in every manner.

I remember a Visual-C++ advert from Microsoft many years ago: The web is woven in one language. It is unfortunate that all resources to develop good languages are so scattered. Nearly every week someone presents a new breathtaking language. Mozilla is developing Rust. Google is working on Go and Dart. And I'm pretty sure we will get something new from Microsoft. They all try to capture us in their ecosystems. It would save us billions of dollars and endless hours to focus on the existing languages and push them forward to that, what we really need, fast and bug-free compilers and a set of matured libraries.

comments powered by Disqus