Cognitive Scaffold

Preparing your thinking workspace

arrow_back_ios_new
MENTAL MODEL · M0037

Kernighan's Law

Kernighan's Law
BusinessmediumManagement
Included
account_tree

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

psychology

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

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/3

Practice this model in one real situation:

Check to track your progress (stored locally)
Learning progress0%
account_treeGenealogyexpand_more
menu_bookReferencesexpand_more

Source support: Explicit

RELATED MODELS