5. Law of Cybernetic Entomology
“There’s always one more bug.”
Often called Lubarsky’s Law of Cybernetic Entomology, it’s unclear who this Lubarsky actually is. However, his principle rings true for all programmers: no matter how cleanly you write your code, no matter how robustly you test your modules, no matter how often you refactor your classes, there will always be another bug.
In a way, this is a freeing principle. While we should definitely strive for bug-free code, it’s also important to remember that perfectionism is the enemy of good. Look for bugs, fix them when they arise, and then move on.
6. Kernighan’s Law
“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.”
Brian Kernighan, the very same one who co-authored the C programming language bible, is famous for this insightful law. The crux of it is this: write good code, write readable code, write simple code, anything as long as it’s not clever code.
Trying to flex your programming muscles with ivory tower complexity is the exact opposite of what it means to write clean and better code. The harder your code is to understand, the harder it will be to debug when it inevitably breaks.
And as Robert C. Martin explains, it’s not just about debugging either:
“Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code . . . [Therefore,] making it easy to read makes it easier to write.”