Finding the cause.
THE METHOD
Establish what you expected Establish what happened Find where they diverge
WHAT TO DO FIRST
Reproduce it reliably.
An intermittent problem you cannot trigger cannot be fixed with confidence.
WHAT TO NARROW
Which input causes it Which line it fails on What the values are at that point
THE SIMPLEST TOOL
Printing values at key points.
Crude, effective, and frequently enough.
WHAT TO PRINT
The value and its type.
A surprising number of bugs are a value being a different type than assumed.
WHAT A DEBUGGER ADDS
Stopping at a point and examining everything Stepping through line by line
WHEN TO USE ONE
When printing is not locating it quickly.
WHAT TO DO WHEN STUCK
Explain the problem aloud, step by step.
That frequently reveals the assumption that is wrong.
WHAT TO CHECK
Your assumptions, one at a time.
WHAT NOT TO DO
Change several things at once Assume the library is at fault