It’s funny to read about the F-35 Lightning II jet fighter. It may be an example of a colossal project development failure. Read this article “Meanwhile, the F-35 is still a train wreck“… a projected US$1.3 trillion train wreck. Why is it so bad? If has often been pointed out that it suffers from software problems. Of course this is all speculation, but considering how many years planes have been flying, it can’t really be the planes superstructure. So what’s the problem? Too much software? Inexperienced programmers? OR maybe it’s the programming language being used.
The project for the Joint Strike Fighter, was supposedly the first DoD project which allowed the use of C++. Now for those that know the background to programming languages in the DoD, you will understand what a big issue this might be. DoD spent a LOT of effort in the design of Ada for exactly these kind of projects. So why not use Ada? I mean real-time systems are it’s thing – it LIVES for them. Ada is extensively used by Boeing, 99.9% of the code in the Boeing 777 is Ada. It may be because software written in Ada would be too costly? Or maybe there are too few Ada programmers. According to report on the net, the majority of the code is written in C/C++, with only 5% written in Ada.
C++ is not a bad language per se. It’s just, well kinda suffers from bloat. In the words of Richard E. Gooch, “It seduces the programmer, making it much easier to write bloatware“. This is somewhat of a concern when developing embedded and real-time systems. In addition, as early as 2002, the Certification Authorities Software Team (CAST) identified common problems with C++ in DO-178B-compliant applications including compile and run-time issues (the FAA recommends using DO-178B as the vehicle to demonstrate that software is airworthy). There are issues such as dynamic memory allocation in C/C++, which is forbidden, under the DO-178B standard, in safety-critical embedded avionics code. Some of the concerns with D)-178B have to do with the OO features of languages such as C++. Examples include: the overuse of inheritance, particularly multiple inheritance, which can lead to unintended connections among classes, and ambiguity resulting from Inheritance, polymorphism, and operator overloading through dynamic or run-time linkage.
There was once an attempt to create an embedded version of C++ known as “Embedded C++” (yeah, go figure). It basically chopped out multiple inheritance, virtual base classes, templates, exceptions, runtime type identification, virtual function tables, and mutable specifiers. But Stroustrup didn’t exactly like it, expressing that “To the best of my knowledge EC++ is dead and if it isn’t it ought to be” in 2004.
Is C++ better than Ada? It is hard to say. Is Java better than Cobol? Some legacy Cobol code has been translated to Java – does it work, sure. Is it the best idea – who knows? The bottom line is that many programming languages are well suited to the task they are designed for, so why change them? Ada is well suited to tasks involving real-time systems, largely because it was designed that way from the ground up.
Diversity in programming languages is a good thing. Use the one that best suits the task at hand.
For those who are interested, the C++ Coding Standards for the Joint Strike Fighter, can be found here.