Brian Kernighan Quotes
Brian Kernighan gives plain-spoken, practical advice on programming and debugging that will help anyone looking to write clearer code.
-
The most effective debugging tool is still careful thought, coupled with judiciously placed print statements.
-
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?
-
Do what you think is interesting, do something that you think is fun and worthwhile, because otherwise you won't do it well anyway.
-
Controlling complexity is the essence of computer programming.
-
First make it run, then make it run fast.
-
If you haven't used grep, you've missed one of the simple pleasures of life. [2]
-
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.
-
Trivia rarely affect efficiency. Are all the machinations worth it, when their primary effect is to make the code less readable?
-
If you had done something twice, you are likely to do it again.
-
C is a razor-sharp tool, with which one can create an elegant and efficient program or a bloody mess.
-
Mechanical rules are never a substitute for clarity of thought.
-
Don't document bad code - rewrite it.
-
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
-
Another effective [debugging] technique is to explain your code to someone else. This will often cause you to explain the bug to yourself. Sometimes it takes no more than a few sentences, followed by an embarrassed "Never mind, I see what's wrong. Sorry to bother you." This works remarkably well; you can even use non-programmers as listeners. One university computer center kept a teddy bear near the help desk. Students with mysterious bugs were required to explain them to the bear before they could speak to a human counselor.
-
If you're as clever as you can be when you write it, how will you ever debug it?
-
90% of the functionality delivered now is better than 100% delivered never.
-
Each new user of a new system uncovers a new class of bugs.