My Beef with C++
Bjarne Stroustrup is giving two speeches in Finland this week. Stroustrup’s topic is the trends and future of C++. I have been seriously contemplating protesting his speeches. I have thinking about what kind of signs should I make for the event. (These are all jokes, of course, I am not actually going to do this)
“Thanks Bjarne, for ruining the lives of millions of coders”
“Because of you, Bjarne, I hate my job”
“I hope C++ dies as soon as possible”
“You look almost as ugly as C++”
“What where you using, when C++ was designed?”
“Seriously, was that [C++] the best you could come up with?”
Anyway, I have a serious beef with C++. The more I have to use the more I despise it. Biggest problem is that everyone has their own idea of what C++ should be. So basically one code base could be using 15 different programming languages, except they are all called C++.
Don’t try to sell me the crap that you can write bad code in any language. That is true, but no other language, which I know of, allows you to write so complex stuff in so many different ways that it requires multiple PhDs to understand what is happening. Bad programmers will write bad code in any language, but at least I might understand it. I have been coding C++ (or C with classes) for too long and I am still baffled every time I see templates mixed with operator overloading.
Why do people have the need to do complex things, when a simple solution would do the job? Are they trying to prove their superiority as C++ coders? Maybe they are making themselves irreplaceable, because no one else will understand their code. “He must be good coder, because no else will understand his code”. I think that is bullshit. Good coder is someone who writes code that others can follow easily. I don’t respect people who write so complicated code that my head starts to hurt when I see the code.
There are way too many features in C++. You can get a decent language out of it, if you keep most of the features away. I assume Google is doing a pretty good job with this. They have a pretty clear style guide that dictates what features are allowed and what are not. However, unfortunately everybody has their own idea of what features should be used and what shouldn’t be used.
The hell breaks loose when there is no common agreement what features in C++ are allowed. The result is a complete mess, and this is where my beef with C++ is. It’s like talking the same language, but not understanding what the other guy is saying. The language provides so many different ways of doing things that nobody could ever learn them all. This is C++’s fault and companies’ fault. If there is no agreed way of writing C++, people will write it as they like, and everybody likes to do it a bit differently. No other language makes this possible. C++ is basically a language with as many sub-languages as there are programmers.
March 16, 2010
|
Posted by Tuomas Pelkonen
Categories:
Tags: