Big Think Interview With Bjarne Stroustrup
Bjarne Stroustrup is a computer programmer most famous for having designed and implemented the computer programming language C++, one of the most widely used programming languages in the world. His book "The C++ Programming Language" is the most widely read book of its kind and has been translated into at least 19 languages. In addition to his five books, Stroustrup has published hundreds of academic and popular papers. He currently holds the College of Engineering Chair in Computer Science at Texas A&M University.
Question: What inspired you to create C++?
Bjarne Stroustrup: In the really old days, people had to write their code directly to work on the hardware. They wrote load and store instructions to get stuff in and out of memory and they played about with bits and bytes and stuff. You could do pretty good work with that, but it was very specialized. Then they figured out that you could build languages fit for humans for specific areas. Like they built FORTRAN for engineers and scientists and they built COBALT for businessmen.
And then in the mid-'60s, a bunch of Norwegians, mostly Ole-Johan Dahl and Kristen Nygaard thought why can’t you get a language that sort of is fit for humans for all domains, not just linear algebra and business. And they built something called SIMULA. And that’s where they introduced the class as the thing you have in the program to represent a concept in your application world. So if you are a mathematician, a matrix will become a class, if you are a businessman, a personnel record might become a class, in telecommunications a dial buffer might become a class—you can represent just about anything as a class. And they went a little bit further and represented relationships between classes; any hierarchical relationship could be done as a bunch of classes. So you could say that a fire engine is a kind of a truck which is a kind of a car which is a kind of a vehicle and organize things like that. This became know as object-oriented programming or also in some variance of it as data abstraction.
And my idea was very simple: to take the ideas from SIMULA for general abstraction for the benefit of sort of humans representing things... so humans could get it with low level stuff, which at that time was the best language for that was C, which was done at Bell Labs by Dennis Ritchie. And take those two ideas and bring them together so that you could do high-level abstraction, but efficiently enough and close enough to the hardware for really demanding computing tasks. And that is where I came in. And so C++ has classes like SIMULA but they run as fast as C code, so the combination becomes very useful.
Question: What makes C++ such a widely used language?
Bjarne Stroustrup: If I have to characterize C++’s strength, it comes from the ability to have abstractions and have them so efficient that you can afford it in infrastructure. And you can access hardware directly as you often have to do with operating systems with real time control, little things like cell phones, and so the combination is something that is good for infrastructure in general.
Another aspect that’s necessary for infrastructure is stability. When you build an infrastructure it could be sort of the lowest level of IBM mainframes talking to the hardware for the higher level of software, which is a place they use C++. Or a fuel injector for a large marine diesel engine or a browser, it has to be stable for a decade or so because you can’t afford to fiddle with the stuff all the time. You can’t afford to rewrite it, I mean taking one of those ships into harbor costs a lot of money. And so you need a language that’s not just good at what it’s doing, you have to be able to rely on it being available for decades on a variety of different hardware and to be used by programmers over a decade or two at least. C++ is now about three decades old. And if that’s not the case, you have to rewrite your code all the time. And that happens primarily with experimental languages and with proprietary commercial languages that change to finish... to meet fads.
C++’s problem is the complexity partly, because we haven’t been able to clean it up. There’s still code written in the '80s that are running and people don’t like their running codes to break. It could cost them millions or more.
Question: What is the difference between C and C++?
Bjarne Stroustrup: C has the basic mechanisms for expressing computations. It has iterations, it has data types, it has functions and that’s it. It doesn’t get into the game of expressing abstractions. So if I want a matrix in C, I would have to say, I want an array and then I want a whole bunch of arrays and when I want to get the third element I have to program my way down to the third element of the fourth row or something like that.
In C++ you can define something, call it a matrix, you define a subscript operator. If you don’t want rectangular matrixes you can get pentadiagonal matrices, triangular matrices that’s the kind of stuff that people... the expert in that field are interested in. And you build that set of concepts and then you program it directly. It’s easier to program, it’s easier to debug and sometimes it’s even easier to optimize for performance when you are expressing the notions at the higher level, at the level where an expert in the field operates, rather than trying to have the expert in the field, say the physicist, also be an expert in dealing with the hardware, with the computer. There are fields still where you have to have a physicist and a computer scientist to get the work done, but we would like to minimize those because the skill sets are not the same. So you want to lift from the hardware towards the human level.
Question: Is C obsolete?
Bjarne Stroustrup: This is somewhat controversial. I think it is obsolete. I think the languages should have been merged into one, so that C would have been a subset of C++ instead of nearly a subset of C++. And then people could have used whatever parts of the C++ tool set they needed. As it is now, there are still enough incompatibilities that you have to remember which language you’re writing in, and I don’t think that is necessary. It appears to be a historical necessity, but it is not a technical necessity.
I’ve argued for compatibility, very strong compatibility, all the time. I mean, I started working on C++ three doors down from Dennis Ritchie and we were talking every day. The competition and tension that has been between C and C++ over the decades certainly didn’t come from home.
Dennis Ritchie wrote that first book that Brian Carnahan, now I’ll have dinner with Brian next week. We’re still very good friends as we’ve always been, but sometimes the programmers of the languages don’t quite see it that way. It should have been one language.
Question: What is the future of programming?
Bjarne Stroustrup: There’ll be a unified language, but I’m not talking about programming language. I’m talking more about a unified design style, a unified set of guidelines for how to combine the techniques. I certainly hope that there will not be just one programming language. I don’t think that’s at all likely and I would be sad because we would have lost a lot when we don’t have this tension between the languages that allows us to make progress. I mean, the middle ages may have been very comfortable, but I don’t think I would have wanted to live there. I like the diversity of ideas and the early ideas rubbing up against each other. That’s how we make progress.
Question: Are you a proponent of open source software?
Bjarne Stroustrup: I am generally in favor of open source software with very few, if any, restrictions. So I like the BSD Licenses. I am not anti-commercial. I would not put something into my license that would be a virus against commercial use.
On the other hand, I don’t think that all software can or should be open because there’s a lot of sort of boring stuff that requires a high level of expertise to deal with. I mentioned sort of the firmware layers and hardware and such. There’s very few people that really understand it. You don’t get it maintained by a couple of volunteers because you need maybe five, 10 years experience in a particular field to do anything constructive and there’s lots and lots of software that’s not glamorous, that’s not interesting where you’ll simply not get the strength of the open source movement where you have lots of people, lots of contributions both individuals and organizations. But there’s a lot of software where people just aren't interested. And for that you need something else to keep it going and that’s usually the dollars that people get for doing the hard, sometimes boring, and sometimes advanced stuff. So I think we always will have open source software and some closed.
I guess I should add that C++ is used to both anyways, so. I don’t have a... I don’t have a horse in that race, so I have both.
Question: What are the five most important languages that programmers should know?
Bjarne Stroustrup: First of all, nobody should call themselves a professional if they only knew one language. And five is a good number for languages to know reasonably well. And then you’ll know a bunch, just because you’re interested because you’ve read about them because you’ve wrote a couple of little programs like [...]. But five isn’t a bad number. Some of them book between three and seven.
It would be nice beyond that to know something quite weird outside it just to have an experience, pick one of the functional languages, for instance, that’s good to keep your head spinning a bit when it needs to. I don’t have any favorites in that field. There’s enough of them. And, I don’t know, if you’re interested in high-performance numerical computation, you have to look at one of the languages there, but for most people that’s just esoteric.
Question: What are the most interesting trends in technology?
Bjarne Stroustrup: Many things are interesting these days. The interesting thing for me is the computers they have inside it. And so when you see things, cars driving down there, planes flying and such, you can see them as a distributed computing system with wings or distributed computing system with wheels.
I was over in Germany earlier in the year to speak to the German automotive software conference. And I don’t know much about programming cars, but I got an invitation to go down and see how they programmed the BMWs, which is C++, so that'll be interesting. Not that the other weren’t, but those are cool cars. And I’ve worked with some people up at Lockheed Martin where they build the F-35s, the new fighter planes, which is C++ also. So I get some insight in how things are used.
And so at the bottom of all of this is the technology of the hardware, there’s the technology of the communications stuff between it, networking, and on the hardware side what has happened a lot is the multi-cores. You get concurrent programming both from the physical distribution and for the... what’s under the chip themselves. And this is interesting to me because my PhD topic was distribution and concurrency and such. So I’ve been looking at that. So that’s interesting.
And a lot of the most interesting applications these days fall into that category. Take our cell phones: the last time I looked there are several processes. Take a single... take an SLR camera, it’s got five or six processors in it and the cobble in the lenses, I mean, that's some interesting code there. And so whether you think of that as technology or gadgets. I think of them as a gadget. I mean a cell phone or a new jetliner, they’re gadgets. They are things you program and there’s programs in it, there’s techniques, lots of computers.
What I haven’t talked about much about, and what I don’t think that much about is sort of the web kind of thing and the web business. From my perspective, that’s somebody else’s business except when the scale becomes really huge. So you have things like the Google search engines with C++ and I get interested, they get interested. Facebook has recently turned to C++ because they needed the performance. I guess in some way of saying here’s my contribution to dealing with global warming because if you can double the efficiency of those systems, you don’t need yet another server farm that uses as much energy as a small town.
So my view is that there's software and there’s computers in just about everything and if you look at interesting things, well, you find it.
Question: What is your work setup like?
Bjarne Stroustrup: I travel with a little laptop, the smallest real computer I can get. So the 12-and-something screen and... but a decent processor speed. And where I am, I plug it into a dock and I use two screens and such and then I network to any other resources I want. If at all possible, I would like to make that machine smaller, but... or at least lighter. Larger and lighter would be nice, but I don’t get it and too light if you’re stuck in a sardine-class seat on a plane, you still should be able to open up and write. And you can’t do that with one of those bodybuilder’s editions. So a smaller machine, convenient machine that you can carry with you and plug it into a bigger system network to more resources.
My laptop is a Windows. People always ask that. And they can’t understand why it’s not my Linux. Well, my Linux happens to sit on my desk and it talks to a traditional Unix through it. So I use both on a daily basis. It just happened that it’s easier to carry the Windows books around.
Question: Do you prefer to work at night or during the day?
Bjarne Stroustrup: Real thinking, real work goes on fairly early in the day. And then in the evening, no, not really sort of thought work, not creative work. I can polish stuff. I’m not a night bird like that. I like to think when I’m fresh.
Question: Do you listen to music while writing code?
Bjarne Stroustrup: Quite often, yes. I have a mixture of stuff on the computer; I just plug in the earphones and listen. And there’s a mixture, there’s classical, there’s a bit of rock, there’s a bit of country. It’s quite surprising what I can actually work with and what I can’t because it really does affect it. There’s music that sort of takes over and you think about the music, rather than the code. That’s no good. And then there’s music that you don’t hear... that doesn’t help either. And well, so well I found something that works, probably just for me, but I like some music.
Question: What advice do you have for C++ developers?
Bjarne Stroustrup: Most people don’t use C++ anywhere near as well as it could be used. There are still a lot of people that are trying to use it as a glorified C, or as a slightly mutated Java or SmallTalk, and that’s not the right way of using it. Go back, read one good book and see if you are up to date or if you happen to be stuck in the '80s or '90s. We can do much better. And then, next year, C++ OX will arrive, the next generation of C++ and it’ll support some of the modern programming styles that has been proven useful over the last decade or so—significantly better than C++ 98, which was the previous standard. And so learn a little bit about it, look at what has been done and try to understand why it was done. Things are just about to get much better.
Recorded August 12, 2010
Interviewed by Max Miller
A conversation with the creator of C++.
Good science is sometimes trumped by the craving for a "big splash."
- Scientists strive to earn credit from their peers, for grants from federal agencies, and so a lot of the decisions that they make are strategic in nature. They're encouraged to publish exciting new findings that demonstrate some new phenomenon that we have never seen before.
- This professional pressure can affect their decision-making — to get acclaim they may actually make science worse. That is, a scientist might commit fraud if he thinks he can get away with it or a scientist might rush a result out of the door even though it hasn't been completely verified in order to beat the competition.
- On top of the acclaim of their peers, scientists — with the increasing popularity of science journalism — are starting to be rewarded for doing things that the public is interested in. The good side of this is that the research is more likely to have a public impact, rather than be esoteric. The bad side? To make a "big splash" a scientist may push a study or article that doesn't exemplify good science.
Moans, groans, and gripes release stress hormones in the brain.
Could you give up complaining for a whole month? That's the crux of this interesting piece by Jessica Hullinger over at Fast Company. Hullinger explores the reasons why humans are so predisposed to griping and why, despite these predispositions, we should all try to complain less. As for no complaining for a month, that was the goal for people enrolled in the Complaint Restraint project.
Participants sought to go the entirety of February without so much as a moan, groan, or bellyache.
Two space agencies plan missions to deflect an asteroid.
- NASA and the European Space Agency (ESA) are working together on missions to a binary asteroid system.
- The DART and Hera missions will attempt to deflect and study the asteroid Didymoon.
- A planetary defense system is important in preventing large-scale catastrophes.
SMARTER FASTER trademarks owned by The Big Think, Inc. All rights reserved.