Unit 07 · overview
Unit 7: Debugging Like a Developer
Debugging is not the part of programming where you randomly change code until the red text disappears.
It is an investigation.
Build a case from evidence
A useful debugging sequence is:
reproduce -> observe -> locate -> form a hypothesis -> change one thing -> retest
This Unit teaches you to read tracebacks from the bottom up, identify exception type and failure location, add targeted output or debugger observations, reduce a problem to a smaller reproducible case, and keep a record of what you tried.
You will see why the first visible symptom can be far away from the actual cause. A KeyError at a report line may begin with malformed data loaded earlier. A wrong total may execute without any exception at all. Both are debugging problems, but they require different evidence.
The debugging case file
Choose one real bug from the Unit and keep a short case file containing:
- the exact reproduction steps;
- expected behavior;
- observed behavior;
- traceback/output or state evidence;
- your first hypothesis;
- the smallest change you tested; and
- the evidence that the repair worked.
A failed hypothesis is allowed. An undocumented guess is not.