Skip to content

11 03 16 exam post mortem, debugging

mona edited this page Nov 30, 2016 · 1 revision

Read "Head First" chapters 9-12.

Debugging

  1. Overcome your belief that your code is right and computer is right
  2. Use a real debugger or assertion, not print!

The best case is that you find the bug in unit test and you know the bug manifest in that unit.
The worst case is that your customer detected the bug, that means you need to reproduce.

crashing bugs

run code in the debugger which will automatically be triggered at the point of crash. Check belief.

non-crashing bugs

start with breakpoint just before bug exhibited, then check beliefs. Narrow down where beliefs went wrong.

If you can find the earliest place your belief doesn't hold, that the bug may obvious. If not, trace back to determine how to got to that point.

  • control branches
  • function/method calls
  • slices

Try to find the smallest set of wrong values.

Clone this wiki locally