Kernighan's Law
Version 1.0.0 · Updated 2026-07-30
CORE DEFINITION
A programming aphorism attributed to Brian Kernighan says debugging is twice as hard as writing code, warning that excessively clever code makes debugging difficult. “Twice” is rhetorical, not a measured ratio valid for every program or a prescription to reserve half one’s intelligence.
SCAFFOLDING EFFECT
Reduce cognitive load
Evaluate the later costs of understanding, diagnosing, and changing an implementation. Prefer code the team can explain and test; document and measure complexity needed for performance.
Anchor fast decisions
Debugging reconstructs actual execution and its divergence from expectations. Complex control flow, hidden state, and lost context add cognitive burden. Clear structure can help, but no fixed multiplier determines debugging cost.
MINIMUM ACTION
In progress 0/3Practice this model in one real situation:
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more
Source support: Explicit
- lawsofsoftwareengineering.comhttps://lawsofsoftwareengineering.com/print/laws/kernighans-lawverified
PRIVATE NOTES · Only visible to you
SAVED Q&A
ENTRY Q&A · Private saving available
Ask with a clear boundary
thinkingmodels answers from published entry context only.
Your question is sent to thinkingmodels. The answer uses public entry context only.
RELATED MODELS