Interview: Brian Kernighan Talks About Computers, Programming And Writing

Nov. 5, 2013
Brian Kernighan is a teacher, writer and developer. He authored “The C Programming Language” with Dennis Ritchie, the C bible.

Figure 1. Brian Kernighan co-authored The C Programming Language with Dennis Ritchie.

If you have ever looked at C as a programming language then you have probably seen or read, like I did, “The C Programming Language” by Brian Kernighan (Fig. 1) and Dennis Ritchie. It probably did more to make C the leading programming language in the world than anything else except the language itself.

Brian Kernighan is a computer scientist. He worked on Unix with its creators Ken Thompson and Dennis Ritchie at Bell Labs where C was also developed and used on Unix. Ken Thompson, Dennis Ritchie, and Brian Kernighan were nominated by Electronic Design readers for the 2013 Electronic Design Engineering Hall of Fame.

Brian is a prolific writer and programmer working on projects like AWK. He is currently a Professor at the Computer Science Department of Princeton University, where he is also the Undergraduate Department Representative. I had a chance to ask him about his work and writings.

Wong: How did you get started with computers?

Kernighan: I think I was a junior in college before I saw my first computer.  (It was a long time ago.)  I learned a bit of Fortran, which was fun, did some Cobol (less so), and finally started to learn about programming when I was in grad school.  The summer I spent at Project MAC at MIT was probably the thing that convinced me that this was something I wanted to keep doing.  It had lots of good people, a very smooth computing environment, and a productive language (MAD).  A couple of summers after that working at Bell Labs and I was hooked.

Wong: How did you get mixed up with C?

Kernighan: If one wanted to write code for the then-new Unix system in around 1972 or 1973, C was really the only choice, and of course I was working in the same group as Ken Thompson and Dennis Ritchie so there was a lot of expertise right at hand.  I had written a tutorial for Ken's B language, and revised it into a tutorial for C. I also started writing significant application programs in C, though by today's standards they were pretty small.

Wong: What was it like writing K&R C?

Kernighan: Incredibly rewarding in every way.  I had to twist Dennis's arm a bit into agreeing to write a book with me, but it wasn't too hard.  I wrote the first draft of most of the tutorial chapters, though the system programming parts were Dennis's.  Then we simply took turns refining and polishing, except for the reference manual in Appendix A, which was all his and remained essentially untouched, since no one else could improve on how well he had done that.

Wong: You developed a lot of other languages like AWK.  Which was the most fun and interesting?

Kernighan: AWK was perhaps the most instructive, since I was working with Al Aho and Peter Weinberger, two exceptionally smart and experienced guys.  It was also a lot of fun to work on EQN, which I did with Lorinda Cherry. It's a language for describing mathematical expressions in words so they can be typeset.  (Think math mode in TEX, which EQN influenced.)  That involved interacting with people who were not programmers but needed to learn a language anyway; it sparked a life-long interest in specialized languages for odd domains.

Both AWK and EQN were done with other people. The Ratfor preprocessor for Fortran was something I did on my own.  That was great fun, because it converted the rather klunky and awkward Fortran of the time (early to mid 1970s) into a pretty nice and expressive programming language, basically by using the syntax of C. The need for Ratfor has gone away as Fortran has slowly evolved into a more pleasant syntax, but at the time I remember it as fun to write Fortran in Ratfor; the control flow was very C-like.

Wong: What are you working on now?

I spend most of my time on teaching and advising undergrad research projects during the school year; there's not a lot of time left over for doing my own thing, so I'm mostly working vicariously through my students.  Let to my own devices, I do a fair amount of playing with scripting languages and web tools, trying to keep up with a very fast-moving field.  It's kind of a losing battle, but worth the effort anyway.

Wong:  You have been a prolific writer.  What is your latest book, D is for Digital, all about?

The book is based on my Princeton course "Computers in Our World," which is for students in the humanities and social sciences.  The course is meant to describe how computing works -- hardware, software, networking, and systems built upon them -- for a non-technical audience.  The intent, or perhaps just fond hope, is to help students understand computing and communications technologies, how to reason about how systems work, and how to be intelligently skeptical about technology and technological claims.  So it's really intended for any person who would like to understand how computers and gadgets work and how they connect to each other and to us.  If you're already technically knowledgeable, it might help you explain to your less technical friends and family what you do and why it's important.

Sponsored Recommendations

Understanding Thermal Challenges in EV Charging Applications

March 28, 2024
As EVs emerge as the dominant mode of transportation, factors such as battery range and quicker charging rates will play pivotal roles in the global economy.

Board-Mount DC/DC Converters in Medical Applications

March 27, 2024
AC/DC or board-mount DC/DC converters provide power for medical devices. This article explains why isolation might be needed and which safety standards apply.

Use Rugged Multiband Antennas to Solve the Mobile Connectivity Challenge

March 27, 2024
Selecting and using antennas for mobile applications requires attention to electrical, mechanical, and environmental characteristics: TE modules can help.

Out-of-the-box Cellular and Wi-Fi connectivity with AWS IoT ExpressLink

March 27, 2024
This demo shows how to enroll LTE-M and Wi-Fi evaluation boards with AWS IoT Core, set up a Connected Health Solution as well as AWS AT commands and AWS IoT ExpressLink security...

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!