Debugging is mostly the work of getting to a reliable reproduction. Before that point it’s guesswork, and guesswork scales terribly: change a line, refresh, add console.log after console.log until eleven of them print and you can’t tell them apart. The Coding Gopher calls that “not debugging, that’s a seance.”
His three steps start with not touching the code. First, hypothesize: state specifically what is failing (“we invalidate the cache before the write commits, so a concurrent read repopulates it with the old value”), not “the data is wrong.” A hypothesis is useful because it can be wrong. Second, isolate: strip away everything that isn’t the bug until you have the smallest failing case; most bugs are found here. Third, write the failing test. Once it reproduces reliably the fix is usually trivial, and the test stays forever.
He also says to learn a real debugger: a conditional breakpoint (“pause here, but only when user ID is null”) replaces a hundred print statements.
This is An experiment chooses between rival explanations at desk scale. A specific hypothesis gives the reproduction something to decide, and the failing test is the experiment.
Caveat: some bugs resist reproduction: races, load-dependent failures, production-only data. There the work shifts to logging and observability, which are reproduction in slow motion. “90% fixed” is a rhetorical number, not a measurement.
Key Quotes
- “A bug you can reproduce on demand is already 90% fixed. Everything before that point is guesswork and guessing scales terribly.” (03:50)
- “A hypothesis is something you can be wrong about, which is what makes it useful.” (04:28)
Related:
- An experiment chooses between rival explanations — a reproduction decides between hypotheses
- Effective AI coding treats output as hypotheses to be validated rather than code to review — the same habit applied to generated code: the test is what accepts or rejects it
- Every bug anyone hit before you is sitting in the history, and a lot of people don’t know how to query it — once you have a reproduction, bisect can find the commit