c++...no, really!
Back in 2003 we built yahoo! shopping on c++. The language was immature, the tools were horrible, and we were never able to reconcile our compressed schedule with the special demands c++ makes if you want stable, quality code. So for a few years I only touched c++ sporadically, checking in on the language now and then but mostly dismissing it as a mess and a relic.
In the last couple of years I have dived back in to using c++ on some personal pet projects, mostly based on the comments on the web that indicated that c++11 was a major step forward, and a sane subset now existed for application developers. It is important to distinguish the use-case of building applications - c++ has always been a great tool for bit-twiddlers, but my needs were a bit higher up the stack, more typical of tools like java and c# (whereas the bit-twiddler may merely consider it as a more modern c).
As c++11 is now a mature subset and we are on the precipice of c++14 being implemented, I now feel confident recommending c++11 as an applications development language for nearly anyone willing and able. I specifically say c++11 - the entirety of c++ is still a mess. Bjarne Stroustrup has mentioned on occasion that there is a great language hiding in the totality of c++, and I believe c++11 is that language.
In my c++11 code, RAII is the order of the day and new/delete tend to almost never appear. Most of the higher-level constructs (lambdas, iteration, etc) emerge from the c++11 spec or from the STL. As a result, I almost never have to code higher-level constructs anymore. Indeed with basic type inference, much of my code is becoming cleaner and shorter, typical with what I might compose with Go. there's even basic support for functional programming.
But most of these advantages can be delivered by java/c#/d/Go etc, so why bother? I see a number of reasons to continue with c++:
- first-order citizenship. c++ lets me directly address my platform. One day when OSs are not written in c, this may not be the case, but I don't see this changing any time soon. Being a first-class citizen on the platform also means the ability to deploy shared-libraries that can be used in many high-level tools.
- control over memory. My daily coding tends not to be constrained by memory, but memory use and the impact of garbage collection still seems to be an issue for java coders which doesn't seem to be going away.
- c++ is still the benchmark for performance. When you demand performance, there's no where else to turn.
- access to benchmark implementations. Many of the libraries c++ coders use, such as openssl, are considered the benchmark for their domain.
There are some things that can be improved, namely:
- batteries included. Networks, http, event support etc are not going away, they should be supported by standard c++.
- make etc. Basically the entire build toolchain. It all still sucks.
- frosting. c++ could stand to use a little marketing muscle to get application developers to consider it in place of java.
last update 2013-12-13