Tuesday, July 16, 2024

Bjarne Stroustrup on Educating Software Developers

Datamation content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Bjarne Stroustrup is a leading figure in modern software development. As the designer of the C++ language – used in everything from the Google search engine to the iPhone – his contribution has impacted countless development projects.

After 24 years as a researcher at Bell Labs, in 2002 Stroustrup became a professor at Texas A&M University, where he holds the College of Engineering Chair in Computer Science. The experience has given him insight into the all-important task of educating tomorrow’s software developers.

In this interview he speaks frankly about the challenges and problems – and improvements being made – in computer science programs. Among issues like perceptions of offshoring and the need to balance the theoretical with the practical, he addresses complaints by tech companies about the lack of fully qualified CS graduates.

He notes that “The US industry could absorb more good developers than there are currently students enrolled in IT-related programs – but not all of those programs and all of those students would qualify as ‘good’ in this context.”

He also talks about CS programs’ overemphasis on Java, echoing an earlier Datamation interview of Robert Dewar, a CS professor at New York University. Yet while Stroustrup agrees that Java has been used to dumb down CS programs, ultimately, “the problem is one of attitude, more than an issue of programming language.”

Despite these concerns, Stroustrup brings a degree of optimism to the process of improving CS programs. He notes that he’s not alone in wanting change, that many people and organizations are working to revise and upgrade CS studies. It will take time to know the optimal mix of techniques and subjects, yet great energy is going into the effort all over academia – a vital process if the US is to continue to be competitive in software development.

Bjarne Stroustrup, designer of the C++ programming language
Bjarne Stroustrup

It’s interesting that you left a full-time research job with Bell Labs to take a teaching post — some might consider a research job to be development Nirvana, with no student meetings, no university demands. What motivated you to become a professor?

Bell Labs was broken up into Lucent Bell Labs and AT&T Labs. The old Bell Labs (AT&T Bell Labs) was indeed remarkably close to the ideal for practical research aimed at changing the world for the better and I’m often “homesick” for it. Unfortunately, it no longer exists.

Its successor organizations – especially AT&T Labs, with which I’m still associated as an AT&T Fellow – tried hard to live up to the high standard set by Bell labs, but that was not easy. Part of the “secret” of Bell labs was a unique mix of practicality and a stable long time horizon for promising ideas – often 10 years.

As far as I know, no current industrial research organization has that. They are “under the gun” from business people and Wall St. to deliver now; many think that two years is “long term.” I’m sure my managers at Bell labs had a much better idea how long it would take AT&T to benefit from C++ than I did when I started, and how. They probably also had a better idea how much good it could do, yet they encouraged me, supported me through difficult years when results were sparse, and most interestingly from today’s perspective encouraged me to spend more time to get more things right.

And that work was done in an organization that had the greatest density of smart, well-educated, hard-working, creative computer scientists I have ever seen. Our interactions were more collegiate than I have seen elsewhere – without those great colleagues, I could not have done the work I did. For a list of names, see this page. Another essential aspect was the range of areas that AT&T was involved in and that Bell Labs consequently received practical challenges from. In particular, I talked with people involved in switching, networking, network management, VLSI design, board layout, billing, satellite communication, speech analysis, routing, graphics, databases, and much much more.

The old Bell Labs doesn’t exist anymore – though I will certainly encourage young ambitious researchers to look at AT&T Labs; it has much to offer. I could have stayed in AT&T Labs’ research center in Florham Park, NJ forever, but the interesting problems from the engineering and development areas weren’t coming the way they used to do. Also, after 24 years in one place, I felt the need for something new.

Academia was – and is – a challenge for me. Academic research is far more different from industrial research than I had imagined and teaching itself poses a new whole new set of interesting problems for me. When I first graduated, I had a positive dread of becoming a teacher/professor because I had seen too many professors for whom academia was their whole world – they had never seriously experienced the world outside school. I did not want to become such a teacher/professor. 24 years after, I felt I had something to contribute based on my experience.

I also had some – rather naïve – ideas of perusing noble goals with a group of likeminded professors and students, coming closer to the ideals of Bell Labs than was possible in today’s economic climate in industry.

Do you feel that university CS programs are properly preparing students for the demands of the marketplace? When I interviewed Robert Dewar, professor at NYU, he claimed that companies are complaining about the lack of skills among computer science graduates. Have you heard these complaints? If so, why do you think these companies are dissatisfied?

I have heard many complaints. Some from large corporations, such as Adobe, Apple, AT&T, IBM, Intel, and Microsoft, and many from companies that are less known for their software. Basically every company I visit has a shortage of qualified software developers. I have even had questions from strangers in airplanes: “You’re a professor? In software? Have you got any students? Here’s my card.”

Personally, I mostly hear such complaints/requests from companies that are involved in providing some sort of infrastructure for their own applications or for sectors of industry. I suspect that is simply a reflection on where C++ is most important so they talk to me, and that the problem is ubiquitous in organizations that provide large complex systems. I consider the problem/need universal. The US industry could absorb more good developers than there are currently students enrolled in IT-related programs – but not all of those programs and all of those students would qualify as “good” in this context.

Take a simple example: A friend of mine looked at the final projects of a class of third-year CS students from a famous university. Essentially all had their code littered with “magic constants.” They had never been taught that was bad style – in fact they had never been taught about programming style because the department “taught computer science; not programming.” That is, programming was seen as a lowly skill that students either did not need or could easily pick up on their own.

I have seen the result of that attitude in new graduate students: It is rare that anyone thinks about the structure of their code or the implications for scaling and maintenance – those are not academic subjects. Students are taught good practical and essential topics, such as algorithms, data structures, machine architecture, programming languages, and “systems,” but only rarely do they “connect the dots” to see how it all fits together in a maintainable program.

Robert Dewar made an essential point. The companies are complaining because they are hurting. They can’t produce quality products as cheaply, as reliably, and as quickly as they would like. They correctly see a shortage of good developers as a part of the problem. What they generally don’t see is that inserting a good developer into a culture designed to constrain semi-skilled programmers from doing harm is pointless because the rules/culture will constrain the new developer from doing anything significantly new and better.

Also, people in industry tend to be impatient. To significantly improve the results of education takes years. Remember, the 2012 graduates are already in university and the 2016 graduates just entered high school.

You’ve said that you decided to design a first programming course after noticing that many students, even from top schools, lacked the fundamental skills to design quality software. What were you seeing, and what skills should high schools teach to prepare better developers?

The “magic constant” example is indicative. Few students see code as anything but a disposable entity needed to complete the next project and get good grades. Much of the emphasis in teaching encourages that view.

The students I saw were neither stupid nor lazy; they were simply systematically pointed in another direction. Next, I looked at the textbooks used for beginning students and found them fairly accurate, but tedious, uninspiring, and dodging important hard issues. They never went beyond the basics – most of the C++ standard library was deemed “advanced” and at best presented towards the very end of a semester course. Worse still, they were insufferably verbose and obsessed with technical details.

Had I been given such books as a 1st year student, I would have changed fields. Those books were trying to spoon feed the students. Good students need to be challenged! The contemporary Math, Physics, and Biology books I have seen are far, far more conceptually challenging than what we present to CS and engineering students in the area of programming.

So I designed and taught a beginning programming class several times using slides and notes that I wrote along the way, replacing the traditional textbook we started out with. My textbook Programming – Principles and Practice using C++ will be available in December 2008. I’m also making supporting material, such as lecture slides, available so I hope some of my ideas will see wider use.

One thing that’s different is that I sat down and asked myself: “what does a student have to know before starting a first project to produce code for the use of others?” Assuming supervision for that first project, my book and course is an answer to that question. The answer includes error handling, class design, file I/O, graphics and minimal GUI, standard library containers and algorithms. It also presents the basic principles of object-oriented programming and generic programming.

The aim is to instill a degree of professionalism; to get to the point where the students can write software suitable for the use by others than themselves. The book presents more material, more advanced material, and moves faster than other books aimed at that level of student. Apart from that, it is quite conventional. You could say that I expect more from my students and trust them more than is conventional. I assume them to be adults. So far, it worked for many hundreds of students.

What should high schools do to prepare students for university-level software development? When I entered a Math course as a 1st year student, the department head said something like this in his welcoming lecture: “I don’t care if you know math – we’ll teach you that from scratch – but I hope you know how to work hard and to read & write English, because you’ll need that to keep up.” I think he had an important point: current freshmen appear to have been spoon fed and many find it hard to adjust to independent work and to shake the impression that you work only to improve your grades.

High schools could teach students to work hard at something (just about anything), to search out information as needed, and learn to express their ideas in writing and orally. Project-based work is good for that. Exactly which programming language is used for software is less important, but the aim should not be to make tasks as simple as possible but to challenge students.

What would you recommend to increase the quality of computer science education in university programs?

That’s a big question. Let me first narrow the scope of my answer to those who will eventually go into industry and take part in software development in some capacity. Let me also emphasize that I’m not alone in wanting change and that work on improvements is going on all over academia.

This work takes many forms and goes in many different directions. It will take time before we know what really works, what is the right mix of subjects and techniques. Many, many people and organizations are trying to improve the CS programs. I certainly don’t claim to have the one true answer, but to make my opinion just a little concrete let me describe what we do locally.

In Texas A&M University’s Computer Science and Engineering department, we just revised our undergraduate program. In addition to the aim of general improvement of quality throughout, we aim to be more responsive to the needs of the many students who go to industry and to the needs of the industries they go to. The approach of “working backwards” from the desired end results was applied repeatedly. For example, a graduate should be ready for a first job and after the first two years a student should be ready for a first internship.

In addition to the classical and essential foundations of computer science, such as algorithms, data structures, and machine architecture, we include repeated exposure to practical topics and projects. Repetition is necessary because students forget and integration of theoretical and practical parts is needed to create a balanced view. I’m very keen to fuse the theoretical base with practical skills. I see computer science as ideally an applied (engineering) discipline and see too many people disregarding either the theoretical or the practical parts.

We adopted my book/course as the introduction to programming/software for our freshmen. It was originally designed for Electrical and Computer Engineers and is not a classical CS 101 text. Similarly, we let the EE department teach the hardware subjects to the CS students. In the second year, we add two more languages to the student’s tool chest (currently Java and Haskell). You cannot be a professional in the IT field while being comfortable in only one language. Projects with a software development focus appear repeatedly. In addition to specialized courses, there is a project in the first year programming class, a programming studio in the second year, and a capstone project in the final year.

In the last two undergraduate years, students add a specialization (“tracks”) to a common core. Examples are “Algorithms and theory,” Systems,” “Software,” and “Information and intelligent systems.”

Is there any way to teach the art of programming, as opposed to the craft? Is this aesthetic skill teachable?

Actually, I think the ultimate aim is to make programming more of an engineering discipline, more mathematical or scientific; “craft” and “art” are both needed, but there ought to be a scientifically based core on which people can base their craft and art. Software design and implementation is more than a craft; there is more math, science and engineering to know and apply than is customary for fields we call “crafts.” Incidentally, I find it appalling that you can become a programmer with less training than it takes to become a plumber.

I think aesthetics can be taught to many. Mostly it is a case of repeatedly showing students good examples and explaining why those examples are good. This takes time, years. I would like for programmers to present portfolios of their work, much in the way artist (including architects) have to. I don’t think everyone is cut out to be a programmer, just as not everybody is cut out to be a musician. Thus, we should not claim that program aesthetics is teachable to everybody. Drawing from the experience of crafts and arts, we should consider instituting a system of apprenticeships.

Some critics of university CS programs, notably Dr. Dewar at NYU, say there’s too much emphasis on Java in the classroom, that creating applications with pre-built Java libraries isn’t rigorous enough. Do you agree?

Basically yes, and Joel Spolsky (“Joel on Software”) said it stronger still. I have had direct and specific requests for students “who understand machines and systems; not Java” from several major industrial players.

I’m not sure how much of the problem is Java itself and how much is the emphasis on using libraries, though. The trouble is that Java has in many places been used to dumb down the curriculum while at the same time increasing the apparent level of delivered goods. It is good to be able to (quickly) build new things by calling libraries, but often that’s not a skilled, challenging job. If that’s all you have seen, you are completely lost when faced with a job for which a pre-packaged solution does not exist. This is just as bad as trying to build everything from scratch yourself. I think the problem is one of attitude, more than an issue of programming language.

Education should prepare people to face new challenges; that’s what makes education different from training. In computing, that means knowing your basic algorithms, data structures, system issues, etc., and the languages needed to apply that knowledge. It also means having the high-level skills to analyze a system and to experiment with alternative solutions to problems. Going beyond the simple library-user level of programming is especially important when we consider the need to build new industries, rather than just improving older ones.

A specific critique of the Java-based approaches has been that not dealing directly with memory is harmful to students’ mastery of data structures and leads to programmers ignoring resource usage issues, which is damaging when a program needs to deal with large amounts of data relative to available memory size. I’m not a fan of undisciplined pointer use and “spaghetti data structures”; I prefer data to be presented with rigorously specified interfaces (for starters, think “STL”).

However, I agree with this specific criticism to the extent that in my own teaching, I emphasize memory layout and size of objects. I also use pointers and iterators to express data structures and algorithms because that seems to express the fundamental ideas more directly. I think that the distinction between what points and what is pointed to (prominent in C and C++) is fundamental and important.

University CS programs have seen lower enrollments due to fears by students that most jobs will be outsourced. Do you think these fears are justified? Or, to put the question another way, some observers are skeptical about whether American developers will be able to compete long term with developers from other countries, students who have more rigorous educational standards at an earlier age. Do you share this worry?

Yes, the perception that outsourcing and offshoring is putting an end to software development in the US is harming enrollment. The sad thing is that much outsourcing happens because there are not enough good developers in the US – because the enrollment and graduation rates of good students are down.

I think that the impression that jobs have gone is at odds with reality. In 2008 there were more people working in the US IT industry than even before; more than before the dot com bust. I believe that is also the case for interesting, challenging, high paying software development jobs. The starting salaries of CS and EE majors compared to every other field are a strong indicator that this is so. However, many parents and many mainstream journalists haven’t noticed and think it is still 2002. At TAMU, the decline seems to have stopped and our enrollment is up a bit, but not far enough. I believe that’s not all that unusual.

There is another enrollment problem that’s endemic: Not enough women choose computer science. If – as in some technical fields – women were about 50% of the students, we’d probably have the opposite enrollment problem: we’d have to cut back by raising standards! I do not know why (though I suspect I have heard all the popular explanations), but CS seems particularly unattractive to women entering university – throughout the US and Europe and beyond.

That’s a bleeding shame for CS; the field seems to have become steadily worse at recruiting women since 1980 or so while other areas of study, including math, biology, medicine, and some branches of engineering have done better. I’d love to help reverse that trend. For starters we should have a more serious discussion of the problem.

For a shorter term solution to the lack of software developers, I think that companies could look closer to home. Too often they search for people based on a narrow model based on currently fashionable buzzwords. In doing so, they miss many experienced, well-educated developers. Given a bit of retraining – or a bit more flexibility in the business – and a bit of money, such people are available. In particular, many could be tempted back into programming – their real love – from management, sales, and other “related fields.” This could be far cheaper than trying to hire or train lots of “cheap” programmers.

Has the process of teaching C++ changed your feeling about the language? Now that you know how students grapple with it, do you feel changes are needed?

Certainly. I thought that C++ had become too “expert friendly” and offered too few supports (language features and libraries) to help novices (of all backgrounds). Now I know that’s the case.

Some help is on its way in C++0x and I hope we will see some libraries that are supportive to novices (of a wide variety of backgrounds). Part of the problem is that the sheer number of available libraries is overwhelming for a novice. Finding a library, selecting it among a set of alternatives, downloading it, and installing it are not skills that are common among novices. Worse: those libraries don’t all work well together or with the standard library components. Somehow, the C++ community has to do better in making libraries more accessible to novices.

Let’s consider C++0x. The simpler features are already becoming available even though we are still at least a year from the standard becoming formalized. Consider a simple example:


The { } initializers can be used for any types in any context and auto indicates that the type of the variable is to be that of the initializer, here

The loop could be further simplified by using the new range for statement:


None of this is earth shattering. It isn’t meant to be, it is meant to make C++ easier to use for both novices and experts.

From your experience as a programmer, what is it that makes a great developer? Can you point out a few qualities, both technical and personal?

Curiosity, initiative, tenacity, ability to reason logically, ability to communicate and to work with others. That’s not at all special for programmers, I’m afraid. Also, I strongly prefer to be around people with a sense of humor.

Your advice for young programmers — or for not-so-young programmers?

Programming is part of software development. It doesn’t matter how fancy your code is unless it solves the right problem and you can explain it to others. So, brush up on your communication skills. Learn to listen, to ask good questions, to write clearly, and to present clearly. Serious programming is a team sport, brush up on your social skills. The sloppy fat geek computer genius semi-buried in a pile of pizza boxes and cola cans is a mythical creature, best buried deep, never to be seen again.

Learn your first language well. That means trying it for difficult tasks. Don’t obsess about technical details. Focus on techniques and principles.

Learn another programming language; choose any language that’s quite different from what you are best acquainted with. You can’t be a professional in the IT world knowing only one language. No one language is the best for everyone and for everything.

Don’t just do programming. Computing is always computing something. Become acquainted with something that requires your software development skills: Mediaeval history, car engine design, rocket science, medical blood analysis, image processing, computational geometry, biological modeling, whatever seems interesting. Yes, all of these examples are real, from my personal experience.

Go to Bjarne Stroustrup’s FAQ page

Subscribe to Data Insider

Learn the latest news and best practices about data science, big data analytics, artificial intelligence, data security, and more.

Similar articles

Get the Free Newsletter!

Subscribe to Data Insider for top news, trends & analysis

Latest Articles