There’s been some discussion more recently about a pervasive question: “why C++?” People have argued over the merits of the language itself, and its key differentiating qualities. In brief, as I view them, those qualities are:
- (Some degree of) portability
Other considerations are, in my opinion, missing the mark. Through the lingua franca of C almost any piece of code can be coupled up to almost any other piece of code. “There’s already a world of things written in C++” doesn’t fly in my book. I use C libraries from Ruby all the time. I use C++ runtimes from Ruby all the time.
So then why would I stand up to defend C++?
I like C++.
But if I had infinite time to develop software, if there were no deadlines, I’d pick C++. To me, eking more performance out of the same chip is exciting. To me, having an iron-fisted control over the execution and type system is fun.
And I say these things as a reasonably accomplished Rubyist. I grok duck-typing. I say these things as a reasonably accomplished Objective-C programmer. I grok black-box OOP (note: if you don’t know what I mean by that, ask me – it’s a fun topic I could talk about if you want, 314).
Is it wrong that some days there’s just a pure joy in coding up something in C++? No. In some cases the very weaknesses of C++ become inherent strengths. When you need the speed without compromising on the additional eloquence of object-oriented programming, when you need the little extra metal, C++ can be a very powerful tool.
I’ll always like C++. Despite the pain and frustration it sometimes gives me, there’s still that simple addictive quality to it. I don’t program because it’s easy, I program because it’s hard. And C++ is harder, and as many know, that makes it more fun.
I like C++ because it’s fun.