LLearnCode
Academy/foundations/Reason about systems

beginner · 27 minute study

Turn a failure into a controlled experiment

Learn to diagnose a defect from evidence instead of changing code until the warning disappears.

Loading progressEvidence grows with practice
Useful preparation · 1 prerequisite

Use this as a map, not a lock. If these ideas are familiar, continue.

First, build a mental model

An error is an observation, not yet an explanation. Reduce the uncertainty with a reproducible case, a specific hypothesis and a test that could prove that hypothesis wrong.

  1. Observe the exact symptom and the conditions in which it appears; distinguish the first error from later consequences.
  2. Reproduce with a small fixture so the same input reliably demonstrates the problem.
  3. Trace actual values at the boundary where the behavior first diverges from the requirement.
  4. Change one relevant cause, then rerun the reproduction and neighboring cases.
  5. Add a regression test for the intended behavior. A suppressed exception is not evidence that the underlying operation became correct.
Read the codejavascript · educational example
const lines = [{ quantity: 2 }, { quantity: 3 }];
let units = 0;
for (let index = 0; index <= lines.length; index++) {
  units += lines[index].quantity;
}
console.log(units);
  1. Index 0

    Read quantity 2 and add it to units.

  2. Index 1

    Read quantity 3 and reach units = 5.

  3. Index 2

    The condition still permits 2, but lines[2] is undefined. Reading quantity fails before the final output.

Production thinking

Take this beyond the example.

Keep diagnostic logs useful and sanitized. Avoid pasting secrets or customer data into debugging tools. An AI explanation is a hypothesis until the reproduction and tests support it.

Sources and further reading

Your evidence

unseen is a local learning signal, not a credential or proof of production competence.

Explain the mental model, then explicitly acknowledge it. Opening a page is not evidence.

Supported retries can complete this lesson. Independent evidence and delayed review determine the skill stage.

Next lesson · One thread can still have overlapping operations →