Technology -> Applications
By: David Norfolk, Practice Leader - Development, Bloor Research
Published: 7th January 2013
Copyright Bloor Research © 2013
There is no question that C++ is currently used in a lot of mission-critical applications (but, then, so is COBOL) and in a lot of commercial software packages. But is it a dying language, due for replacement by Java, C#, Python, Scala and so on? And, considering that a lot of COBOL and Fortran is still in active use, does this matter much anyway?
The answers are probably "no" and "no". Things are still happening in the C++ world. The latest Intel compilers, for example, are extremely good at optimising code for the latest Intel architectures and its Threading Building Blocks helps you exploit parallel programming on multicore architectures efficiently. Now there's a new C++ standard which addresses many of the issues associated with C++ programming. Even Bjarne Stroustrup says that C++11 feels like a new language here - read more in this interview.
Standard C++11 still lacks Java-style garbage collection, used to clean up allocated memory that is no longer needed (and I'm not sure that relying on programmers to do their own garbage collection is entirely safe), but it does include a state-of-the-art threading library. Many programmers don't like garbage collection, because of the propensity for basic Java to stop for a few seconds while garbage collecting, but that's an implementation issue and you can get modern high performance Javas with better-managed "deterministic" garbage collection facilities offering predictable latency (see, for example, Oracle JRockit). Read about the C++11 innovations here.
Embarcadero's new C++Builder XE3 compiler, which supports the new C++11 standards and allows VCL (Visual Component Library, a visual framework for building Windows applications originally developed by Borland) and FireMonkey (which is what Embarcadero calls its "modern, multi-platform, hardware accelerated GUI and application framework") to be moved onto 64bit platforms, is another sign that interest in C++ is still active. Embarcadero (or, rather, Borland, part of which it acquired in 2008) has a good record for providing productive developer tools and its new compiler promises "agile C++". In other words, developers can use Embarcadero extensions to make C++ up to 5x faster than traditional development, Embarcadero says, using rapid prototyping, PME (properties/methods/events) component-based programming, and visual development. Of course, that's hard to verify in the general case (and no improvement at all satisfies the "up to" 5 times promise) but if you are, or want to be, a C++ shop, it's probably worth investigating (the original Borland C++ Builder was pretty good).
Embarcadero's new compiler builds on clang, a front-end for the respected open-source LLVM compiler, which (it says) will address any advantage Intel compilers have in exploiting Intel's architectures And, usefully, Embarcadero promises industry-leading compliance with the C++ standards.
The key promise of C++Builder XE3, however, is that it will let you target multiple platforms with a single codebase and a single developer team. That sounds good to us, although it won't really come to fruition until its iOS and Android on ARM capabilities arrive. This is also a 64bit compiler, with good support for a Windows 8 look and feel interface, so it offers lots of options for legacy C++ Windows application modernisation (it supports (Windows XP, Windows Vista, Windows 7, and Windows 8). And support for Mac OS X and Retina Display (letting developers deliver a native user experience and automatic HiDPI display support in Mac applications) has to be a bonus. Despite the C++11 improvements, we suspect that native support for a wide range of popular desktop and mobile user environments will be what drives any actual C++ resurgence.
On balance, C++ probably wouldn't be our language of choice these days for general business systems, where something like Java (or Scala) will probably be more productive overall. But C++ is still the optimal choice for some applications and a perfectly adequate choice (if you have the right C++ skills) for many more; and we aren't in the business of building applications anyway. C++ certainly isn't anything like dead yet and, according to C++ guru Herb Sutter, now "computing feels young and fresh in a way that it hasn't felt for years, and that has only happened to this degree at two other times in its history" - although he's talking about the UI and mobile devices, which are what modern C++ has to support.
Posted: 7th January 2013 | By NM :
Garbage collection (GC) is no longer that much necessary due to the presence of the smart-pointers in C++11 (shared_ptr, unique_ptr, weak_ptr -- although by default you're just supposed to use unique_ptr, and only use shared_ptr when sharing; having to use weak_ptr is extremely rare and might indicate a design flaw in your program).
C++98/03 already supports RAII, which is automatic resource management (scope-bound, not garbage collected) -- what's even better it applies uniformly to *all* resources -- memory, files, threads, network sockets, you name it. Much easier than mucking around with try-finally or try-with-resources in Java.
In fact, the best practice (as documented in, e.g., C++ Primer, 5th edition) is not to use raw-pointers, new/delete, or manual memory management at all and instead rely on the above-mentioned standard techniques (that's what the C++ Standard Library itself does).
The messages above were all contributed by IT-Director.com readers. Whilst we take care to remove any posts deemed inappropriate, we can take no responsibility for these comments. If you would like a comment removed please contact our editorial team.
All fields must be completed to submit a comment. Email addresses are passed through to the author so they can contact you directly if needed.
Published by: IT Analysis Communications Ltd.
T: +44 (0)190 888 0760 | F: +44 (0)190 888 0761