diff --git a/README.md b/README.md index cfaa3c1..efa76af 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,20 @@ See also: - [The Law of Leaky Abstractions](#the-law-of-leaky-abstractions) - [XKCD 1172](https://xkcd.com/1172/) +### 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. + +Kernighan's Law is named for [Brian Kernighan](https://en.wikipedia.org/wiki/Brian_Kernighan) and derived from a quote from Kernighan and Plauger's book [The Elements of Programming Style](https://en.wikipedia.org/wiki/The_Elements_of_Programming_Style): + +> 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? + +While hyperbolic, Kernighan's Law makes the argument that simple code is to be preferred over complex code, because debugging any issues that arise in complex code may be costly or even infeasible. + +See also: +- [The KISS Principle](#the-kiss-principle) +- [The Unix Philosophy](#the-unix-philosophy) +- [Occam's Razor](#occams-razor) ### Metcalfe's Law