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.
TR: Is C++ too hard for most programmers?
BS: It shouldn’t be. To use C++ well, you have to understand design and programming technique. In a sense, my critics are right: not everybody should write C++, but then I never claimed they should. C++ is designed to allow you to express ideas, but if you don’t have ideas or don’t have any clue about how to express them, C++ doesn’t offer much help.
TR: How do you account for the fact that C++ is widely criticized and resented by many programmers but is at the same time very broadly used?
BS: The glib answer would be, There are just two kinds of languages: the ones everybody complains about and the ones nobody uses. The main reason for C++’s success is simply that it meets its limited design aims: it can express a huge range of ideas directly and efficiently.
TR: In your book The Design and Evolution of C++, you claim that Kierkegaard was an influence upon your conception of the language. Is that a joke?
BS: A bit pretentious, maybe, but not a joke. A lot of thinking about software development is focused on the group. Corporate practices can be directly hostile to individuals with exceptional skills and initiative. I consider such management of exceptional people both cruel and wasteful. Kierkegaard was a strong proponent of the individual against the crowd. I can’t point to a specific feature of C++ and say, “See, there’s the influence of the 19th-century philosopher,” but he is one of the roots of my reluctance to eliminate expert-level features. I’m not particularly fond of his religious philosophy, though.
TR: What do you regret the most?
BS: No regrets! Well, of course I dream of what I might have done differently and better–but who am I to second-guess, say, 1984-vintage Bjarne? He may have been less experienced than I, but he was no less smart, probably smarter, and he had a better understanding of the world of 1984 than I have. C++ has been used to build many systems that enhance our lives, and it has been a significant positive influence on later languages and systems. That’s something to be proud of.
The AI revolution is here. Will you lead or follow?
Join us at EmTech Digital 2019.