Insights from Bjarne Stroustrup, Creator of C++
Bjarne Stroustrup is a renowned Danish computer scientist and the creator of the C++ programming language. Stroustrup’s work has profoundly impacted software development, making C++ one of the most widely used programming languages for system/software development, game programming, and real-time simulations.
This article will showcase some relevant quotes from Stroustrup, providing meaningful insights into his philosophy and the far-reaching impact of his contributions.
About Bjarne Stroustrup
You’ve created one of the most efficient and fastest programming languages. No doubt, that has changed our world. Have you, as a person, changed while working on it?
Interesting question! Not one I have thought much about. I guess an answer will have to distinguish between properties that have remained constant and those that have changed immensely.
- My interest in broad issues, including history and philosophy, has been constant from quite early on and I think it has been significant for the development of C++. I said so in D&E in 1994. Similarly, my desire to build things more that digging deep into academic pursuits has given an engineering bias to my work. I value performance, low cost, and reliability. That, combined with an emphasis on feedback, evolutionary progress, and appreciation of real-world problems, shaped C++.
- One aspect of my work that has steadily increased over the years is education. As I tried to explain my ideas, I realized that you can’t just build something, you must teach people to use it well. That has always been a problem for C++. Often, my message was drowned by people with a simpler vision and a willingness to make larger claims. “We can’t teach teachers fast enough” was my common complaint in the 1980s and 1990s, so C++ was often taught in ways I thought were horrendous. No wonder some people got a very negative view of C++!
Had I known I’d spend much of my life speaking and writing English, I’d probably have paid more attention in my English (foreign language) classes. My travels gave me a lot of insight in a huge variety of problems and the range of problems you had to face to solve them. Many of the most difficult problems were organizational, management-related, and educational. In that, my reading of broader topics helped more than my technical education. I learned that a high degree of humility is needed for good language design. There is so much we don’t understand, the world changes constantly, our problems change constantly, and we change.
What was your best decision ever?
That I allowed myself to be curios and take chances. I did not know what a PhD was, but I thought it was a good idea to try it out, and see if I could make it. I was interested in immersing myself into a subject area. Later on, it was my PhD degree that opened the doors for me to Bell Labs in New Jersey, which was the most amazing place to be if you wanted to engage in practical computer science and system building. I learned so much while I was there. I was lucky — but you can only gain from luck by being aware of your options and come prepared with a good education and a little confidence.
- In an interview for The Department of Computer Science at the Aarhus University
In Bjarne’s Words
“I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone”. I said that after a frustrating attempt to use a “feature-rich” telephone sometime around 1990. I’m sure the sentiment wasn’t original, and probably not even the overall phrasing; someone must have thought of that before me.
“There are only two kinds of languages: the ones people complain about and the ones nobody uses”. Yes. Again, I very much doubt that the sentiment is original. Of course, all “there are only two” quotes have to be taken with a grain of salt.
“Proof by analogy is fraud”. Yes; page 692 of TC++PL. A good analogy is an excellent way of illustrating an idea, but far too often such analogies are not accompanied by solid reasoning, data, etc.
“Teach for the future; you have to live in it”.
“Don’t be clever”. Yes. In the CppCon 2017 opening keynote: The Learning and Teaching Modern C++. The accompagnying slide says “Don’t be (too) clever” but I can’t promounce parentheses :-). My point was to discourage overly clever code because “clever code” is hard to write, easy to get wrong, harder to maintain, and often no faster than simpler alternatives because it can be hard to optimize.
Always be suspicious of ‘of course’: ‘of course’ is not a reason.
Beware of ‘obvious’; it often means “I haven’t thought carefully about it”.
“The only thing that grows faster than computer performance is human expectation”. Yes, often since the late 1980s. It was my standard answer to suggestions that we really didn’t need to work on making software efficient any more because hardware is getting faster. Of course, today, single core performance hasn’t improved for years.
“Friendship is neither inherited nor transitive”. Yes. It’s a C++ language rule from the earliest days.
“Only half of the C++ community is above average”. Yes, in a WG21 evening session discussing future directions. The point was to remind the C++ standards committee members that they should design for the C++ community at large, rather than just for experts like themselves.
“Our civilization runs on software”. Yes, stating the obvious. It’s a plea for more reliable and maintainable code. If our computerized systems fail badly, many will starve.
“Every new powerful feature will be overused and misused”. Yes. It’s an observation — a statement of fact. After a while and some experimentation, good programmers find what works in real-world development and what’s just overenthusiasm.
The Importance of Software
“Our civilization depends on software”, you’ve said.
And that dependency is growing. We would die of starvation if software stopped working. A city like New York has food for no more than two or three days. If trucks began to malfunction, trains came to a standstill or if traffic signals broke down, all of these being computerized systems, people would starve. I’m not joking. Agriculture depends on computers. We are as reliant on software as we are on water.
Are there any applications or uses of C++ that you have been especially surprised or excited about?
What amazed me most was the range of applications: from rice cookers to space rockets. It is humbling to realize that just about wherever you look there is C++ involved: cars, movies, games, medicine, finance, computers, farming, etc.
I find it most gratifying that C++ has been used in science: the human genome project, the fundamental physics research at CERN and elsewhere, and the Mars Rovers. It feels great to have made a contribution, however small.
- In an interview with Sonny Li
Acknowledging Engineers
On winning the Draper Prize, you called for society to better acknowledge the importance of engineers. Artists and scientists are more renowned than engineers. Why?
Science is wonderful, but it never does anything on its own. Someone then has to use the science to make a device that we are able to use. You have to apply the science. People think about Einstein and that’s fantastic. But they don’t realize that it took a long time to create the GPS system that uses his ideas. Different societies value engineering differently. If you’re an engineer in Germany, you’re somebody; if you’re one in the UK, people think you drive trains. That’s an exaggeration, but only partly so.
The Value of Learning to Code
What are the benefits of learning code?
First of all: to learn to think straight. If you are sloppy in your thinking (we often are) your program will misbehave. That gives you feedback that a written essay or a verbal argument won’t.
Secondly, you might be able to have the computer perform useful tasks, such as (at an advanced level) stop a train if the track is blocked, drive a car, check your bank balance, analyze blood to diagnose a medical problem, and buy a book. All of these tasks are done today by C++ programs.
Thinking differently, programming can be part of a good job or a productive career.
Should children learn coding?
If they want to. I’m not sure it would be a good idea to put programming into every child’s curriculum. What should be removed to make space? Foreign language, mathematics? History? Physics? Biology? Literature? My opinion is that most US school children already have far too little of those classical and essential topics.
I think there is little point in teaching programming to people who has nothing to compute. I love programming and think that it can be a valuable tool in teaching people to think straight and not fool themselves, but simply playing with game engines and do a little word-processing could easily do harm by distracting for real education.
- From an Ask Me Anything conversation on the Denmark subreddit
Essential Skills for Developers
What are the skills that you think is important for every developer to master?
I can’t think of specific skills that every developer need. It would be nice if everybody could approach problems logically and scientifically, but then parts of development of a large complex system (e.g., a game or an animation) require a more artistic approach. However, for most regular development tasks a logical mind and a sense of proportion is required for success. Those are skills that can be developed through mathematics, statistics, and probability theory.
For developers, the fundamentals of computer science are essential: some knowledge of data structures, algorithms, and machine architecture. Without those, a developer is stuck with doing derivative work and relying on others for performance and scale. This may be fine for some, but not for developers of foundational systems (e.g., drivers, libraries, communications systems, and networking). In addition, some understanding of security is needed for all who write software that interacts with other machines.
Everyone needs a good understanding of the tool chain that they are using, including programming languages, foundational libraries, and application-specific libraries.
In addition, a good developer is a good communicator. You need to listen to end-users and other developers to understand the problems. You need to communicate your ideas (in writing and verbally) to others, or they will have no impact. It’s not all code.
Why do I emphasize “professionalism” in a beginner’s book, and what do I mean by that?
My view of programming is as a tool to get results; it can, of course, also be seen as a beautiful intellectual activity of its own or as an exciting hobby, but that’s secondary to me. I aim to teach people who go on to build systems on which my life and livelihood will depend one day. I want them to be responsible and competent. I want them to be economical with their time and energy. I want them to build the best systems they can. Obviously, when I designed the book and the course that it supports, I was influenced by the fact that I was (am) teaching engineers, some of whom may in a few years time be programming the plane in which I fly or some medical gadget on which I may then depend. On the other hand, I teach engineers because I want the people who build such systems to be competent. By using the word “professionalism,” I mean to emphasize a responsible attitude to system development and (at least) a minimal competence. I am no fan of course focused on examples featuring class hierarchies of cute animals and great mind-bending puzzles (say, Towers of Hanoi). I’d rather see examples showing people to how to validate their inputs and how to structure their code to make undetected errors less likely. I like clever puzzles, but prefer to do them in my spare time.
-In an interview with Takashi Toyota
What’s your advice to young devs?
Yeah, it’s hard to give advice. At least as hard as to take advice.
Don’t over specialize, don’t be too sure that you know the future. Be flexible and remember that careers and jobs are a long-term thing. Too many young people think they can optimize something and then they find they’ve spent a couple of years or more specializing in something that may not have been the right thing and in the process they burn out because they haven’t spent enough time building up friendships and having a life outside computing. I meet a lot of sort of “junior geeks” that just think that the only thing that matters is the specialty of computing programming or AI or graphics or something like that and well it isn’t and the rug might be pulled under them but for that.
And if they do nothing else, well if you don’t communicate your ideas you can just as well do Sudoku. You have to communicate and a lot of sort of caricature nerds forget that. They think that if they can just write the best code they can change the world but you have to be able to listen, you have to be able to communicate with your would-be users, and learn from them, and you have to be able to communicate your ideas to them.
So you can’t just do code you have to do something about culture and how to express ideas and I mean I never regretted the time I spent on history and on math. Math sharpens your mind, history gives you some idea of your limitations, on what’s going on in the world, and so don’t be too sure.
Take time to have a balanced life and be ready for the opportunity. I mean a broad-based education of odd-based skill set, which is what you build up when you educate, you’re patiently building a portfolio of skills, means that you can take advantage of an opportunity when it comes along. You can recognize it sometimes, we have lots of opportunities but a lot of them we either can’t take advantage of or we don’t notice.
It was my fairly broad education, I’ve done standard computer science and compilers, I’ve done multiple languages, I think I knew two dozen at the time, and I have done machine architecture, I’ve done operating systems, and that skill set turned out to be useful.
— In an interview for Honeypot
Many people think of you as their mentor. Could you share your vision — what qualities should a good mentor have, for example, inside of the company/team?
A willingness to listen and to be serious about understanding the problem. Then, a degree of humility when it comes to giving advice — often, our understanding is incomplete. That said, a good Mentor must give concrete advice, not just general vague twaddle. If someone honors you with a serious question, it deserves a serious answer that helps the questioner to move forward. Giving advice is hard.
1. Good questions teach you a lot. They are a major source of progress. A good Mentor learns a lot from students.
Design beyond Imagination
In an interview with Rogue Wave, you said, “I wouldn’t like to build a tool that could only do what I had been able to imagine for it.”
Yes.
How do we do that? How do we design for situations we can’t imagine?
You listen to a lot of people and then you aim for generality.
By generality do you mean more abstract solutions to specific problems? Or do you perhaps mean facilities that a lot of people will need to use? Define generality.
Let’s take an example. A class can do just about anything. C++ does not have separate language constructs to specify classes for big objects, for small objects, for object-oriented classes, for value types, for GUI events, for properties, for threads, and so on. The C++ class concept is general enough to allow a user to specify all of those, and to do so efficiently. One example of generality in the design of C++, then, is that I didn’t decide that classes should be only for big expensive operations because it’s expensive to call them.
In addition to generality in the sense that you’re not restricting users, you can also aim for generality in the mathematical sense. You make sure all the cases work, that a whole logical design space is covered, as opposed to saying there are these five features you should be able to do and no more. Why five? When you design in terms of lists of features or lists of alternatives, you never get the design quite right. There always turns out to be just one more case, or one less. For example, in C++ there are no built-in facilities for doing exactly the events system for a particular operating system. There are general mechanisms with which you can write a class that does an events system for any operating system.”
- In an interview with Bill Venners
Work-Life Balance
You’ve achieved so much in your area, how did you balance your work and life?
It is not always easy, but I think I have managed reasonably well. My children are doing well personally, professionally, and as good citizens. That’s one key measure. When traveling for work, I often brought a child along to show them the world. When the children were young, we always ate our evening meal together (with no TV, computer, or phone), and always I read them “good night” stories. I spent endless time to take children to soccer, swimming, and music. You cannot just work. That way, you eventually burn out. Life is not a sprint but a long-distance run. I have tried to live in nice places, and to visit nice places. My home town of Aarhus in Denmark, where I lived until I finished my MS degree, is a wonderful place. In general, Denmark is one of the nicest places on earth. Cambridge in England, where I got my PhD and now return to regularly, is a magical place. New Jersey, near Murray Hill where I worked for 24 years, is a good place to have a calm, productive, time and to bring up children. I always hated commuting as a complete waste of time, so I have tried to live 10 to 20 minutes from where I work. Reading this, someone might get the idea that I come from a rich family. I do not. My family was thoroughly working class. All my uncles worked with their hands and I am the first in my family to attend high school. However, Denmark is a place that supports education and hard work. By some measures it is the most equal society on earth, and highly developed, so you don’t have to be rich to do well and have a good life.
In addition to programming, what’s your other hobbies and interests?
I read a lot, I listen to music, I like to visit interesting places, and to spend time with interesting people. I spend time with my family. To get some exercise and fresh air, and to stress off, I run. I also like to walk to see places at a gentle pace. It is said that when Danes go abroad, their letters home are half about food. That seems right. A good meal with friends is a real pleasure. I listen to classical music and rock, sometimes even when writing or programming. I read fiction and non-fiction — mystery, science-fiction, novels, a lot of history, and a bit of philosophy. Maybe you could consider my work on the history of C++ a hobby; it doesn’t directly relate to my day job. I have written a book (“The Design and Evolution of C++”) and three papers for the ACM’s History of Programming Languages conference. When the last of those is ready for HOPL’4 in London in 2020, I will have covered the first 40 years of C++. Thinking about history helps me consider why C++ succeeded and what weaknesses it has.
Not sure whether you heard about “996”? In China, it’s quite common for a developer to have a lifestyle of “996” which means working from 9am to 9pm, 6 days a week. Can you share any thoughts on this?
I had not heard the “996” phrase, but I certainly know the phenomenon. For many, there are times in their lives where that’s necessary. I have done that, repeatedly, but it is not a good strategy for every week for years. It’s for bursts of activity at critical times. Add commuting time and there is nothing left. You get dull and possibly miserable. For the best work, we need time to rest and time to think, to reflect. For becoming a good person, we need time to spend with family and friends, to have interests outside work. I have seen people becoming successful in the workplace through “996”, yet being miserable and unkind to people they interact with. My ideal is a balanced life. For me, work is a major part of that, but certainly not the only one. For example, I have some of my best ideas with running, while resting, reflecting on “something else”, and while chatting with friends.
About Denmark
You owe quite a lot to Denmark. Though you’ve lived your entire life in the USA. Would things have been different if you’d been born there?
Probably very different. Denmark is perhaps the most fair and open society on earth. And one of the most favorable societies for people who want to do things. If you have a dream, Denmark is probably the place to pursue it. They value hard work, education is free, they don’t put hurdles in your way, they don’t tell you what you have to do. It’s more complicated today but when I was there it was a more egalitarian, simple society. I’m not sure what I would have done in the US with origins such as mine. People believe that they have done everything by themselves. No. You need a system in which to live: your education, your teachers, friends who don’t stab you in the back. I don’t feel I have the skills to survive in a society ruled by the law of the jungle.
Although it is often recommended never to meet your idols, Bjarne Stroustrup appears to be an exception to this rule. His profound insights, genuine humility, and relentless dedication to both his craft and education reveal a visionary who not only revolutionized the software world with C++ but also understands the broader implications of his contributions.
His willingness to convey complex concepts in a clear and accessible manner sets him apart, making him appear a humble giant. After all, in Stroustrup’s words:
“People who think they know everything really annoy those of us who know we don’t”.
Originally published at https://www.roxanamurariu.com on July 18, 2024.