Kernighan's law
expressionprogramming
'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 wrote it with P. J. Plauger in The Elements of Programming Style (1974), and it has been the standing verdict on cleverness ever since. The law does not forbid sophistication; it prices it, in future-you's debugging capacity at 3 a.m. Code review's most useful question is Kernighan's law in interrogative form: will we understand this in six months?
Debugging is twice as hard as writing the code in the first place, so if you write the code as cleverly as possible you are, by definition, not smart enough to debug it. Brian Kernighan's formulation is a warning aimed specifically at capable programmers, since the incapable ones were never going to write the clever version.
The reasoning is about cognitive headroom rather than skill. Writing code, you hold the whole intent in your head and every line makes sense as you produce it. Debugging, you arrive without that context, often months later and possibly not as the same person, and you have to reconstruct the intent from the artefact. Clever code is exactly the code whose intent is hardest to reconstruct.
The practical consequence is a preference for boring solutions, which is genuinely difficult to sustain because clever code is more satisfying to write and looks more impressive in review. The reframe that helps is that you are not writing for the compiler or the reader today, you are writing for whoever debugs this at three in the morning during an incident, and their available intelligence at that moment is substantially lower than yours right now.