Site icon PaGaLGuY

Talking to Bjarne Stoustrup, the inventor of C++

   

By Anamika and Mihir

Anamika: Hello, I’m Anamika and this is Mihir. And we’re here with Bjarne Stoustrup, who’s the inventor of C++ and also, he’s here at IIT Bombay as a part of Techfest 2015. He’s one of our distinguished lecturers here.

Anamika: It’s a pleasure to have you sir.

Bjarne: Oh, thank you. It’s a pleasure to be here.

Anamika: What… what makes you come here in India.

Bjarne: Well, mostly your invitation actually, but I’m visiting the Morgan Stanley offices in India so it’s both work and… this is the fun part.

Mihir: Sir, a lot of us are interested in knowing this. What exactly was your inspiration in developing “C with classes”, that later went on to become C++, and what challenges did you face? As a grad student, specifically.

Bjarne: Okay. This was done after I was a grad student. As a grad student, I worked in Cambridge and I think the hardest part of being a PhD student is to figure out what you’re going to do. What is the topic and.. what should be a good topic- it’s..its not too hard. So then it becomes technical. You can use all your skills. But… one thing I learned is that I needed good tools- when I was a PhD student. I had experience with Simula- Object Oriented Programming, and I had experience with PCPL – sort of really hard core systems programming. Performance issues were very critical because I was writing simulations, and one of the fundamental things about simulations is that uh.. you use all the cycles and you use all of the memory. Anyway, next I got a job at Bell Labs, and I wanted to build distributed UNIX…UNIX, sort of what today would be a cluster or multicore and in particular, I wanted to evaluate the difference betweem clusters and multicores, that is , do you have shared memory or not. That was what I wanted to do some experiments on with Bell Labs, after my PhD. And…So I needed something that could run really fast, something that could express the lower levels of an operating system. Memory management…shared memory operations…things like…communication between processes and such. But I also needed something that could express the distributed system. You have to express which part goes here and which part goes there and how do they communicate.

So I needed something very low level, close to the hardware, and I needed something that allowed me to abstract away that and express the system at a fairly high level. And there wasnt such a language at the time-didnt exist, You would have languages like Simula that would express the high level. You would have languages like PCPL that would express the low level.But none could do both. So I felt I needed to write one, and I did. And that was fairly quick, I had my first user after half a year. And it was not sort of a long language design project, it was buidling a tool as I needed for very ambitious projects. And then the tool became quite useful, more people used it, and I got distracted and I never got to build this. Otherwise I might have had the first UNIX cluster… in the early 80s, but I got distracted .And built C++ instead.

Anamika: So actually, students in India learn C++ as their first Programming langauge. As opposed to say, Java or Python or any other language. So what’s your take on this?

Bjarne: It’s good and bad. Its good because C++ is a good language. It teaches you something about the underlying systems that the other languages abstract from and it’s uh…it’s quite important to understand systems. In my opinion, if you want to understand Computer Science, you have to understand the foundations in the computer. Machine architecture, operating systems, data structures, algorithms – really fundamental stuff. And C++ is good at that, it doesnt abstract it away. It doesn’t let people believe in magic. Which I’ve noticed a lot of people who just write… They dont even write Java .They write JAVA API calls. So they… The data structures disappear, the algorithms disappear. That somebody else’s problem. And, well, somebody can do that, but it’s not what I’m interested in. And of course, the machine disappears. The cache got completely eaten by the virtual machine. So it’s good that people get something like C++.

On the other hand I thought that it’s taught badly, very badly , in many places. when I went to become a professor about ten years ago, and I had to give a C++ course. I looked at the then textbooks that was available- I was horrified. It was… it was …it was not good. They were not teaching C++ the way I would like to see it and they were trying to abstract way the parts that I thought as important . Like, the low level things are important and the integration with the high level things is important. I think C is a wonderful langauge but it only has a low level part and doesnt allow you to see the high level part. And that was not the way it was taught. And I’ve seen people from a lot of places are being taught C++, including India. And they either think it’s C with some few unimportant features at the end, Or they think it’s an Object oriented programming language where everything ought to be class hierarchies. But somehow, I, I…meaning me, failed to understand that and didn’t throw away the C parts.

And that’s not what it’s about. If you go to my talk today, you’ll see. It’s a very different view. the high and low level parts are there for a reason, and they interact in a reasonable way. So, that’s the bad part. Uh… I did write a textbook… Programming Principles and Practices in C++. Which is exactly that. It’s a programming textbook that happens to use C++. But it also… so it’s not a C++ textbook that also teaches a bit of prgoramming. But it also has a view about what C++ is, has a view about what’s important in programming, And that’s most important for people who has to write high performance stuff, people who has to write high reliability stuff…uh people who has to deal with systems programming, if you’re in one of those areas, it’s the right view of the world. If you’re doing just websites, no, not really the best thing to teach people.

On the other hand, underneath most of the systems, you’ll find some C++. You go into your cell phone – the signal processing and the rendering – that’s C++. If you go to the web… the big sites… underneath it is C++ infrastructure keeping it together. If you’re into that, that’s it. If you don’t want to be, sort of, a serious system developer, then you probably don’t need what I’m trying to teach you. Not all programming problems have the same constraints. Not all programmers develop tools the same way. I think a lot of people forget that. I think they think programming is one thing, and it’s a fairly low level skill. No, it’s not one thing and it’s not a low level skill. They think programming is one thing and it’s a fairly low level skill. It’s a professional skill and .. worth talking about.

Anamika : So coming to teaching, you were a professor at Texas, at Columbia and now you are at Morgan Stanley.

Bjarne : Yeah, my day job is at Morgan Stanley. I’m dealing with, who would expect, but I’m dealing with my usual stuff, Distributed Systems, Reliablility, Performance… Quality code bases… that kind of stuff. The finance industry has problems… beyond the realms of computer science and those areas. So back at real work again, I needed to, because academia can drift away from real world problems… I am trying not to get too far away from that. But I’ve still got a leg into academia so I’m giving a course in Columbia starting two weeks from now. So I’m not totally out of teaching in the academic world.

You know… after my Ph.D, I went into industrial research and there is not much of that left. But that’s where I think my real home is. I am not very keen on just developing the next system. I like to work on something that makes the future a bit brighter… and that’s sort of research-ey.

At least in computer science, drifting to, projects things that have an obvious relation to real-world problems. So I like the intersection of research, and looking into the future, but also firmly grounding in real-world problems

Mihir : Do you think that’s an issue… the disconnect between academia and industry?

Bjarne : It’s a huge issue, and it goes both ways. Umm, we’ve had the industry being disconnected from research and therefore we have stocked techniques and tools that are 20 years old. Academia could also be solving and stocking problems that will remain in the future for the next 20 years, or forever.

Mihir: You’ve been involved in developing one of the world’s major programming languages. What do you think about the nature of programming languages? Do you see it changing fundamentally in the future?

Bjarne: Oh dear… we can have a long discussion about the word “fundamentally”. I think there’s a lot to be done, there’s a lot that can be done, certainly to be major for the individual programmer and for the team. Whether it’s fundamental, the way I think of the word “fundamental”, I don’t know. I really really hope that in the future, we are not going to write code the way we do today. I know we can do it better. I know the ideas, I know the experiments… I know it can be done better. It’s just that whether we get there in the real-world, under real world constraints…compatibility constraints… the fact that systems have a long long lifespan. All modern day systems that are available today last longer than the machine architecture.

Mihir: We understand that you talk today is on the newer implementations of C++. So, what are your personal thoughts on C++ 11 & 14, and what should we expect from future versions?

Bjarne: First of all, C++ 14 is shipping. You can use it today, Clare, GCC, Windows… all interesting twins are there… this is not science fiction.. and basically, they are better approximations to my ideas than the previous versions. If you see my first paper on C++, there is an explanation on why you need generic programming and how to do it. The “how to do it” part was completely missed out. I thought you could do it with macros… and it’s just wrong. It doesn’t scale.

This is the kind of programming one guy could do in a year and spend time maintaining it, for another half an year. I was wrong about that and only with C++ 14, I see getting to where I wanted to be in 1980. So actually, I know roughly where I wanted to go. And the current charge, post C++ 14, has more to do with…we have to simplify.. I want better type-safing, better resource-safing and preferably, this idea that simple things should be simple, without making difficult things impossible.

Mihir: One final question, what would your advice be, to budding computer scientists. For example, to someone who would like to develop the next C++?

Bjarne: Don’t lower your expectations. Be ambitious. Far too many people say “Oh! the world is too complicated. We just have to do what the other guys are doing.” If everybody thinks that way, then we are in trouble. The safe strategy of hiding in the hole… somebody has to be ambitious. Keep ambition levels high… and take what comes with it. Most people with computer science knowledge have a chance of making a difference. So don’t settle for the average until you have to.

Exit mobile version