December 16, 2015
Fifteen years ago, Brian Kernighan told an interviewer that if he were stranded on an island with only one programming language, that language would have to be the one called simply “C.”
He liked C so much that he had co-authored a book that became a mainstay for students of the subject, “The C Programming Language.” But now the Princeton professor has developed a fondness for another language.
“That was a long time ago, so perhaps it would be worth reconsidering today,” recalls Kernighan, who joined Princeton in 2000. “C has the advantage of being simple, easy to learn and use, and good for building other things. So I would probably still start with C on my desert island — but then might use it to build a higher-level language like Go.”
His latest book, “The Go Programming Language,” underscores the rapid changes in programming.
“Go is a comparatively new language,” he says. “It was developed at Google and first released in 2009. Like all new languages, it’s ‘open source,’ which means that anyone can use the code and the tools and contribute to the project. Go is one of a half-dozen languages that are widely used inside Google, but it’s also used a lot outside.”
Kernighan’s co-author is Alan A. A. Donovan, who works on Google’s Go team, designing libraries and tools for program analysis. Kernighan spent the summer of 2014 at Google in New York, working on Go tools with Donovan as his mentor.
“Most programming languages can all do the same things but differ a lot in how easy it is to write programs, how reliable they might be, how fast they will run, and any number of other practical issues,” he says. “Go was developed as a reaction to the increasing complexity of some of the other languages in widespread use at Google, and of course its design was filtered through the experience and strong opinions of its creators. It’s especially good for writing networking code, the kind of programs that respond to requests from web users, and it might be used in COS461, our networking course.”
“Go is sometimes called ‘C for the 21st century,’ though I’m not sure that its creators like that characterization. It is similar to C in its surface syntax (as are a variety of other languages), and it shares some of C’s ‘lean and mean’ approach. If one is a C programmer, it’s easy to pick up basic use of Go. But there’s a lot more to it, including facilities for concurrent programming (making good use of the multiple processors in modern computers) and structuring bigger programs, concerns that weren’t part of C.”
Kernighan earned his Ph.D. from Princeton in 1969 and joined Bell Labs, where he worked in the group that developed the Unix operating system, contributing application software and documentation to the project. Many of his books have built upon the work he did and the relationships he developed there.
His co-author for “The C Programming Language” in 1978 was C’s creator, Dennis Ritchie, who co-created Unix. At Bell Labs, Kernighan also wrote “The Practice of Programming” (1999) with Rob Pike, who later joined Google and was one of the creators of Go.
More recently, he wrote “D is for Digital: What a well-informed person should know about computers and communications” (2011), a textbook tailored for a lay audience and based on COS109, “Computers in Our World,” a popular Princeton course for humanities and social sciences students. He is now working on the second edition.
In addition to COS109, Kernighan teaches COS333, “Advanced Programming Techniques,” an upper-level course on software engineering with group projects. He enjoys both, because explaining difficult concepts is his bread and butter.
“These two courses are completely different, so they are fun in different ways,” he says. “COS109 lets me try to explain really important ideas to a non-technical population that, realistically, will be running the world in a few years. They need to know something about the central technologies of computing and communications so they can make sensible decisions about how to deal with them.
“By contrast, COS333 serves a very technical population. They are the people who are going to be making the technology that the COS109 people have to manage sensibly. Most students in 333 are either CS majors or doing the certificate in Applications of Computing. They'll go on to jobs in software companies or start their own, or they will go grad school and then do the same, or teach others to do so.”
“I really enjoy both groups, and the switch back and forth every year keeps me working all the time. And it’s helpful to have to think about similar topics from different perspectives. For me the main reward of teaching is that I can to try to explain interesting and relevant things while getting to know a bunch of really nice people. That’s hard to beat.”
Kernighan, who wrote an opinion column for the Daily Princetonian from 2006 to 2013, says he’s reluctant to offer opinions about the future of computing.
“Making predictions is hard, especially about the future,” he quips. “I can only guess what will happen, but there are obvious trends. It’s clear that the future holds a rapidly growing number of digital devices, increasingly connected by (usually wireless) networks; the buzzword is "Internet of Things.” General-purpose devices like cellphones will continue to absorb specialized devices like cameras, video recorders, navigation systems, and e-book readers.”
“Programmers will continue to invent new languages, because it always seems possible that some combination of features will make programming easier and safer. Some new languages will catch on, but most will thrive only in niches. Fortunately, good ideas from one language find their way into other languages; there’s a lot of cross-fertilization and borrowing, and if you get only a modest distance away, there are more points of similarity than difference among newer languages.”
— Doug Hulette
See also: With book on new computer language, Kernighan guides students at Princeton and beyond by John Sullivan, March 10, 2016