In the 1980s and ’90s, when he was a researcher at AT&T Bell Labs, the Danish-born computer scientist Bjarne Stroustrup designed C++, arguably the most influential programming language of the last 25 years. For all that, C++ is controversial. The language is widely disliked by the millions of programmers who use it, largely because it is notoriously difficult to learn and use, and because Stroustrup’s design permits them to make serious programming mistakes in the interests of maximizing their freedom of expression. Today, Stroustrup is a professor of computer science at Texas A&M University.
Technology Review: Why is most software so bad?
Bjarne Stroustrup: Some software is actually pretty good, by any standard. Think of the Mars Rovers, Google, and the Human Genome Project. Now, that’s quality software! Our technological civilization depends on software, so if software had been as bad as its worst reputation, most of us would be dead by now.
On the other hand, the average piece of software code can make me cry. The programmers clearly didn’t think deeply about correctness, algorithms, data structures, or maintainability. Most people don’t know how bad it is because they don’t read code: they just see Windows freeze or have their cell phone drop a call.
TR: How can we fix the mess we are in?
BS: We can’t just stop the world for a decade while we reprogram everything from our coffee machines to our financial systems. On the other hand, muddling along is expensive, dangerous, and depressing. Significant improvements are needed, and they can only come gradually. But they must come on a broad front; no single change will be sufficient.
Looking at my own narrow field of programming-language design, my view is that a good language can be a major asset, but only when used appropriately and well. A language doesn’t solve problems; it merely helps the expression of solutions.
TR: What makes for a good programming language?
BS: Anything that helps people express their ideas makes a language better. A language should be good at everyday tasks in the hands of good craftsmen. It matters less whether the language is beautiful in itself. There are more useful systems developed in languages deemed awful than in languages praised for being beautiful–many more.
TR: Isn’t elegance important?
BS: Elegance is essential, but how do you measure elegance? The lowest number of characters to express the solution to a problem? I think we should look for elegance in the applications built, rather than in the languages themselves. It would be a stretch to call a carpenter’s complicated set of tools (many quite dangerous) elegant. On the other hand, my dining-room table and chairs are elegant–beautiful, really. That said, it would of course be best if the language itself was a beautiful work of art.