‹ Start From Zero Lesson 18 of 21
Contents Lesson 18 of 21

3 min read · foundations

Reading a diff — the skill everything else rests on

A diff is what changed. Reading one is the single most valuable habit in this entire track, and it takes twenty minutes to learn.

What you are looking at

  const rows = await res.json();
- const sorted = rows.sort((a, b) => a.close - b.close);
+ const sorted = [...rows].sort((a, b) => a.close - b.close);
  return sorted;

Lines with - were removed, + added, and unmarked lines are context so you can see where you are. git diff shows it; every assistant shows something similar before it changes a file.

That particular change is real and matters: sort reorders the original array in place, so the version without the copy silently rearranges data other code was still using. Course 1 finds it in generated code.

Four questions, every time

From course 1, and worth starting now:

  1. Did it change anything I did not ask for? Generated diffs wander — a rename here, a reformatted block there. Each one is something you now own.
  2. Does it touch how data is fetched or stored? Those are the lines that can leak a key or cost you a hundred requests.
  3. What happens when it fails? Empty list, bad response, no network.
  4. Can I explain it? In one sentence. If not, do not accept it yet.

Small diffs are readable; large ones are not

A twelve-line diff gets read. A four-hundred-line diff gets skimmed and accepted, and skimming is the same as not reviewing.

So ask for one thing at a time. This is the actual reason behind "commit small" from lesson 4 — not tidiness, but that it keeps each change small enough to genuinely read.

Accepting is a decision

The moment you accept a change it is yours. Not the assistant's: nobody else will be answering for it, debugging it at 7am, or explaining it to whoever reads the repository next.

That framing is the difference between using an assistant well and being used by one.

Try it now

Ask your assistant to change something in your fetch script — add error handling, say — and before accepting, answer all four questions in writing. Then run git diff and read the same change in git's own format. Two views of one change, and you now read both.