Why it matters

Bad debugging technique wastes engineering hours daily. Learning good technique is a huge productivity investment.

Advertisement

The architecture

Reproduce: get the bug to happen reliably. Without reproduction, you can't fix.

Isolate: minimize the failure scenario. Remove everything not required.

Hypothesize: form theory of the cause based on evidence.

Test: run experiment that would distinguish causes.

Debugging cycleReproducereliable triggerIsolateminimum caseHypothesize + testiterateBisection cuts search space in half each step; use for large search spaces
Systematic debugging.
Advertisement

How it works end to end

Bisection: for regressions, git bisect finds the commit that introduced the bug.

Print + observe: sometimes the simplest tools work best. Add prints; run; observe.

Debugger: step through code; inspect state. Powerful but slow for large search spaces.

Rubber duck: explain the problem to someone (or a rubber duck). Often reveals the bug.