Why I No Longer Like or Use C++
prophipsi.blogspot.com
prophipsi.blogspot.com
System resources are not as precious as they used to be, so the distinction has become more apparent. Hence, people who use C++ for non-systems programming encounter friction when performance goals are at odds with productivity goals. They then move to languages which take the opposite approach and sacrifice performance for productivity.
I use and like using C++. Yet I don't see any reason to argue when he says C++ is not for him any longer - he's probably right. I think the domain where C++ is appropriate has shrunk and continue to do so, and that's fine.
(For the record, rvalue references are a means to eliminate copying objects. This is, indeed, a performance optimization that most people don't care about.)
Here's a lovely discussion from few years back: http://developers.slashdot.org/article.pl?sid=04/10/27/21102...
and i'm in a position to know. i actually worked at Be for awhile.
A high profile, recent example is Google's MapReduce: http://labs.google.com/papers/mapreduce.html.
The guy also claims that "every single aspect of C++ being designed around higher performance instead of my productivity". This is false. The fact that it allows writing high-performance code does not mean it was one of the primary design goals. It simply was not, this aspect of the language was inherited from C .. which is one of the languages the author declares to be "going back" to. Kind of ironic if you think about it.
There are many features that do have a runtime or space cost, but you only pay for it if you use it. And I think that in many cases, what you end up implementing yourself would pay the same performance costs, if not more.
I basically agree with the author of the post. I've never understood the use of virtual and template classes. However, I like what Anonymous says in the comments:
>Here's the secret to good use of C++: Never use STL. Never use any template libraries. Furthermore, never use templates.
>Pretend that it's C, with some nifty object-oriented features and operator overloading. Nothing more.
The problem really seems to be that there are still some niches where you need something with relatively fine grained control and raw horsepower of C++, but there's not been anything to come along to fill that niche.
A simplified C++ standard would be a step in the right direction. Unfortunately it seems that the standard is moving in the opposite direction.
For what it's worth, I find programming with Qt pretty close to "C++ as it should be".
Here are a few points:
- Heavy template usage makes debugging hard. The Intel compiler does the best job I've seen of reporting sane errors, but it's still ugly.
- Heavy template usage makes the symbol count and binary size explode. Bigger binaries mean more cache pressure, so this slows things down, makes for bigger downloads, etc. (For a project at work recently I had to refactor some of our template based code to be OO instead as heavy template usage and associated expansion was quite literally adding 20 MB to our application's size.)
- The API is fugly.
Binary size is a problem with heavily templatized libraries if debugging information is turned on; if not, there's no problem. I make heavy use of Boost.Spirit, and I saw my binary drop from 21MB to 3.7MB when I turned debugging information off.
And I guess API is just a matter of taste, although I do find myself making short wrapper functions for types of calls I make often. (Such as for_all as a wrapper to for_each on the .begin() and .end() of a container.)
Moreover, STL is beautiful. It was originally designed for Smalltalk if I remember correctly, and it's "ugliness" is nothing more than a bad implementation. Separating alogrithms away from the data types they operate on is a novel idea. Granted, you get it for free in dynamic languages, but STL goes as far as you can get in a rigid world of stone types.
I have been facsinated by C++, by its ugliness, its sheer size, hidden powers and fast code it generates. My interest in it has faded away as CPUs got faster.
In my opinion the biggest issue with C++ is the lack of any kind of modules, and the author of the original post correctly recognizes that. Those endless includes multiplied by need for templates, produce ridiculous build times and make it impossible to hide implementation details (everythin g is still exposed via hpp-files).