Brian Kernighan

Brian Kernighan
Brian Wilson Kernighan is a Canadian computer scientist who worked at Bell Labs alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix. He is also coauthor of the AWK and AMPL programming languages. The "K" of K&R C and the "K" in AWK both stand for "Kernighan". Since 2000 Brian Kernighan has been a Professor at the Computer Science Department of Princeton University, where he is also the Undergraduate Department Representative...
NationalityCanadian
ProfessionScientist
Date of Birth1 January 1942
CountryCanada
I want students to understand specific technologies, but the real goal is that they should be able to reason about how systems work and be intelligently skeptical about technology so that, when they're running the world in a few years, they'll do a good job.
I seem to get totally wrapped up in teaching and working with students during the school year. During the summer, I try to spend time in the real world, writing code for therapy and perhaps for some useful purpose.
Technology is mostly a force for good, but it has its downsides, too. I want my students - and my readers - to be intelligently skeptical about technology and be informed about the good and the not-so-good parts.
An effective way to test code is to exercise it at its natural boundaries
Trivia rarely affect efficiency. Are all the machinations worth it, when their primary effect is to make the code less readable?
Don't document bad code - rewrite it.
Get the weirdnesses into the data where you can manipulate them easily, and the regularity into the code because regular code is a lot easier to work with
Trying to outsmart a compiler defeats much of the purpose of using one.
As we said in the preface to the first edition, C "wears well as one's experience with it grows." With a decade more experience, we still feel that way.
If you had done something twice, you are likely to do it again.
Some compilers allow a check during execution that subscripts do not exceed array dimensions. This is a help, but not sufficient. First, many programmers do not use such compilers because They're not efficient. (Presumably, this means that it is vital to get the wrong answers quickly.)
If you're as clever as you can be when you write it, how will you ever debug it?
Mechanical rules are never a substitute for clarity of thought.
Believe the terrain, not the map