What it is: Safe programming languages focus on providing features that prevent programmers from making trivial but hard to find and debug errors.
Back in the early days of PC programming, two schools of thought ruled. On one side were programmers who used the C programming language. Not only was C a simple programming language that made it easy to create compilers for various operating systems, but C was also powerful enough to access all the hardware of a computer. the philosophy of C was to give you full control over every hardware aspect of a computer but you had to be disciplined enough not to abuse these privileges. More importantly, you also had to make sure you didn’t make any mistakes that could cause your program to completely mess up the hardware of a computer.
Opposite the C programming camp were people who lately embraced “safe” programming languages largely based on Pascal. The idea behind Pascal was to give you most of the features of C but to limit your access to controlling the hardware. While this limited the power of Pascal, it also eliminated many of the errors that C programmers accidentally introduced into every program they wrote or modified.
In the long run, the C programming camp won out, so programming languages like C++ and Objective-C thrived. Unfortunately, so did crippling errors and bugs in software. Because C gave programmers complete freedom, it also gave programmers complete freedom to make major mistakes in their C code. C is such a powerful language that it’s what was used to create most of today’s operating systems from UNIX and Windows to Linux and OS X. Yet the reason why so many programs have bugs in them is because of the C programming language.
Finding and fixing these bugs is difficult, and nearly impossible in large programs like Microsoft Windows. That’s why Microsoft, Apple, and the Linux community continually release updates and patches to their operating systems. Unfortunately each time these companies add new features to the operating system, they also introduce new bugs. Each time they introduce new patches and updates, they also introduce new bugs. Programs written in C and C variants like C++ are essentially error-prone.
That’s why “safe” programming languages are making a comeback. Microsoft introduced their own version of a “safe” programming language by developing C# and Apple introduced their own “safe” programming language by developing Swift. Sun Microsystems tried to avoid the problems of C++ by introducing a “safe” programming language called Java.
C#, Java, and Swift focus first on safety and second on versatility. In comparison, C focused on versatility and power and completely ignored safety. The reason why so many computer programs are buggy is mostly because they were written in C and even the best programmers can’t help but make errors occasionally.
Perhaps one of the safest programming languages is Ada. The Department of Defense originally created Ada to standardize programming languages for defense projects. While this has largely failed (defense contractors routinely use other programming languages besides Ada), the safety feature of Ada is still a compelling advantage. If you’ve ever flown in an airplane, chances are good the avionics program was written in Ada.
That’s because avionics programs absolutely cannot fail while running. While it’s acceptable to reboot a computer when the operating system acts up, that’s not acceptable when controlling a jet airliner carrying hundreds of passengers. C may be a powerful programming language, but Ada is a far safer one, especially when lives are at stake. That alone tells you what’s more important.
In the future, expect more programmers to migrate to “safe” languages like Swift, C#, Java, and even Ada. When reliability is critical, you don’t want to hope a C programmer didn’t make a mistake that could kill you. You want an Ada programmer who can’t make a mistake that can kill you because the language itself helps make it impossible to write crippling errors in the first place.
To read more about how Ada is used in real-time, safety-critical programs, click here.
To read how Boeing relied on Ada to create the avionics program for the 777 jetliner, click here.