#6 Brian Kernighan Professor, Computer Science, Princeton University
Brian Kernighan is one of the founding fathers of modern programming. He was a member of the technical staff at Bell Laboratories at the time UNIX and C were developed, and co-authored the book The C Programming Language with C’
That transition from researcher to professor began at another Ivy League school. In September 1995, AT&T, which owned Bell Labs, broke into three separate companies?and the changes prompted even long-time Bell Labs staffers to think about alternatives. For Kernighan, opportunity came knocking in the form of a call from Margo Seltzer, a professor of computer science at Harvard University, who was going on sabbatical. Would Kernighan like to take over her class for a semester? Kernighan figured he wouldn’
The answer: very hard, especially for a rookie. Kernighan still remembers the exact number of students he had, 457, as well as the 31 “teaching fellows”
One striking thing about Kernighan’
- What do your students want to do in life?
In the technical course I teach every spring, those people mostly see themselves going off into the technical world: to pursue a graduate degree in computer science, to do programming in industry and perhaps ultimately run a business or manage a programming team. They think they will, if not change the world, at least contribute technology that the world will find useful. Some will move up the management chain, some will launch companies, and some will come back to the university and teach. In the short time I’
ve been teaching, I’ ve had students who have traveled each of these routes.
The other class I teach every fall is a sort of “computers for poets” course. Almost everybody is non-technical, majoring in comparative literature, history, economics, political science, anthropology or the like. More than half of the students are women, which is unheard of in a computer science department. [U.
S. Supreme Court nominee] Sonia Sotomayor was a Princeton grad, and I can imagine that if she were at Princeton today, she would show up in my class. I think a lot of the students hope that they too will change the world, but in a very different way. They will be journalists, lawyers and politicians, run big organizations, and volunteer for Teach for America. They will learn some useful technology from the course?almost every year someone tells me how helpful it was to be able to make a Web page?but the main thing they should take away is an understanding of how technological systems work, how to reason about them, and how to be intelligently skeptical about such systems.
- What do you tell your technical class about their plans and dreams?and about the field?
I point out that most of the things we have talked about over the course of the semester are the work of just one or two people. The field is still so young that they themselves could assume that role for their generation. I think there’
s a reasonable chance that some kid in that class could create something as significant as UNIX or C or C++ or Java or Google or Yahoo! or Amazon. All these were fundamentally the idea of just one or two people.
- What skills do you want them learn?
I would like them to have a repertoire of tools at their disposal, including different ways of thinking about how to attack a programming problem. I want them to think about all of the potential tradeoffs they will encounter, to understand that you never get something for free: if you push really hard in one direction, other directions are going to suffer. I work hard on getting them to do things that will always be important, like testing their programs. I want them to consider building special-purpose tools or languages that will help them automate some process, to use the machine to do more of the work for them. And I want them not only to build systems, but be able to talk and write about them, informally and in formal presentations. That’
s pretty important regardless of what they are doing.
In my course in the spring, I give individual assignments in the first half that cover a variety of programming tasks. I tell them that this is a simulation of the real world. We’
re trying to do things that they will encounter, but at a smaller scale. Assignments include mechanically testing programs, ensuring interoperability, coding to a standard, being dropped into the middle of a big unfamiliar program and asked to change it. But the bulk of the course is a group project. They get together in groups of three, four or five and build something significant. They can do whatever they want to do, using whatever tools they choose. They have 10 weeks to do it. At the end of it, they give a presentation and provide written documentation about what they did. And I’ m going to do my best to break their code, so it had better work.
s here where they really learn things. They anguish over what language to use, but they learn that language well. They learn about trade-offs: open source, for example, is a mixed blessing?it’ s wonderful to download a package that does what you want, but then you discover that it doesn’ t quite work right. They learn about make-versus-buy decisions. When they don’ t get code running as quickly as they thought they would, they learn about scheduling. And they learn about working with each other. In the real world, you have to get along with people who don’ t see things the same way you do, whose working habits and styles are different, who you may not even get along with.
- You have written about students playing with laptops and iPhones, rather than being engaged in the class. So on one hand, you have students who program mobile phone applications. On the other hand, those same mobile phones are a big distraction.
s true. Technically, many students find mobile phone development a really interesting area. And it can be lucrative. One group of kids in my class made over $100,000 on an iPhone app. The downside, at Princeton and probably every university, is that kids now spend an enormous amount of time multitasking in class, so much so that the instructor is no longer their primary focus most of the time. I don’ t know what to do about it. I have tried to find “teachable moments,” showing for example how a second, identical Google search retrieves the information faster than the first because the data is cached. Other times, I’ ve run Wireshark, a packet sniffer which can eavesdrop on wireless communications. That presents some good technical lessons about radio, networking protocols, and privacy. The subliminal lesson is that you don’ t know who is listening to you?it could even be the guy at the front of the room.
- While your students have written iPhone applications?and love the device?you do not.
I have not been able to convince the various pieces of Apple software to actually put something on an iPhone. I can do the simulator just fine, but I can’
t put a single bit on the phone itself. I’ ve blown three or four days of work, plus the $100 registration fee trying. It’ s really irritating.
- Have you asked your students for help?
I will when school starts again, and when someone explains where I’
m going wrong, I’ ll be okay. But Apple provides almost zero documentation on this, and the information in online forums is not enough. For me, the device has been poisoned in some way or other, and I have no idea why or how to reset it.
- How has software design changed since you were at Bell Labs?
- So your expectations for your students have increased.
The level always rises. It used to be that people would make a simple Web application with 2,000-3,000 lines of PHP. Now they use a framework like Django or Rails and make something that’
s much richer and complete, with a polished administrative interface that was generated automatically. The code is about the same length, but the end result is much more systematic, robust and maintainable because it’ s based on a more orderly framework. Last semester, there were five Django projects, a couple of Google Web Toolkit projects, several iPhone projects, and two Android projects.
The technology changes rapidly and continuously and that presents a teaching dilemma. I’
m torn between trying to teach students the fundamentals?writing tiny self-contained programs that really work?and dealing with big frameworks that crank out a lot of code automatically but hide what they are doing. There are more of those tools all the time. Which ones are going to still be viable in five years? Which ones will matter in the real world? I certainly don’ t know. The frontier of what students need to know expands all the time, so the best I can do is to expose students to ideas and give them some experience with some modern software systems, without forgetting the fundamentals of good programming practice.
- At the end of your technical course, what’
s your “farewell” message to students?
I usually tell them, because it’
s true, that they have done amazing things. They have managed to come up with something really interesting and made it work well, while they were also enrolled in four or five other courses and doing extracurricular activities. Every year, the combination of more hardware resources and more powerful software systems raises the level of what they can build, so every year the projects are more impressive. It’ s incredibly rewarding to watch this happen.