The past few months have been a jam-packed with a few developments in terms of C++. Not only did C++0x get the almost unanimous nod of the industry to be good enough to be called C++11 but there’s also a few stories that have come out that need some attention too. There was the Google findings which show that C++ is by far the best performing programming language (if you have enough programmers that know the language well enough to wield it proficiently) and C++ AMP which aims to bring massively parallel C++ programming closer to the mainstream by Microsoft. Also, last May BoostCon 2011 was held with a pretty good lineup of talks that Boost users would be most appreciative of. It seems like 2011 is the year that C++ dusts off its boots and starts marching on again to the top of the programming language hill. Or is it?
For a programming language that started in the 80′s and is still being used by and large successfully by the tech companies that matter (I’m talking Microsoft, Google, Apple, Adobe, Facebook) you’d think C++ would enjoy a revered spot in the programming language hierarchy. Unfortunately if you look around and ask programmers what they think about C++ more or less you’re going to find people who will have a number of bad things to say about it. Why does a programming language so hated be so effective and still be in use in industry?
First of all I think it all comes from a fundamental fact that good programmers develop good solutions. If you put a good tool (in this case a programming language) in the hands of a good craftsman (in this case a programmer) then the task you’re set to accomplish would be accomplished with good enough results. You can still get a good outcome if you have bad tools and a great craftsman or if you have great tools and a bad craftsman. But the best results come from good tools in the hands of great craftsmen. Cathedrals, airplanes, ships, bridges, and all the infrastructure that last are built by craftsmen that had access to the best tools they had at the time they were built. I would argue that the software that stands the test of time (those running in Google or Facebook’s servers, Microsoft’s software, Adobe’s software, Apple’s products) are those written by great craftsmen regardless with good tools.
Second reason I can think of is the flexibility of the programming language. There are not a lot of programming languages where you can use it to write device drivers, operating systems, web application systems, realtime monitoring systems, embedded software, desktop applications, imaging applications, and even mobile applications by basing on just a single standard. There’s a good reason why the flexible “general purpose” programming languages enjoy the most usage among the craftsmen that know their craft. It just so happens that C++ has enough flexibility to allow pretty much anything to be done with it with features that support the development of easily scalable software – and I mean scale as in the capacity to grow the software as far as complexity and design is concerned. With a limited programming language that wasn’t focused on “usability” in its current version (C++03) it’s managed to be one of the most effective tools used by a lot of programmers in industry. Now with most of the shortcomings addressed in the upcoming version of the language, the flexible programming language just got a lot more flexible and usable.
The last thing that I think makes C++ a very compelling programming language to use today and going forward is: for any interesting problem to be solved at scale, you’re going to need a programming language that gives you performance, flexibility, and scalability without sacrificing any of these three. I have yet to come across a programming language that comes near the performance profile of C++, supports as many programming paradigms that C++ does, and allows software construction and design to scale favorably as much as C++ does. There are some interesting programming languages that have come out recently but I have still yet to see one that actually can seriously replace C++ as the programming language for “serious software”.
The reason C++ is still significant today is because the problems worth solving require as much of the machine as possible while being efficient in doing so. Sure you can use any programming language to write a web application, but if you’re trying to handle billions of queries per minute and would want to get the most out of the machines you have at your disposal you’re going to use one that allows you to scale your development effort and your application without sacrificing performance. The problems that are worth solving now require massive amounts of computing power and it’s actually an advantage to have your application as efficient as you can make it. This is where C++ as a programming language shines.
With C++ in the hands of experienced and good craftsmen, solutions to problems worth solving are efficient, scalable, and maintainable. With a new version coming up I’d say this decade is the one where C++ is more relevant than ever.
Check out C++ Soup for more articles by Dean Michael Berris