In software debugging, the detective method is a systematic approach. We have a general set of steps:

  • Observe: inspect problem state, validate/invalidate hypothesis.
    • Like viewing stdout or inspecting variables with the debugger.
  • Hypothesise: develop potential cause for observed behaviour.
    • Segfault caused by illegal out of bounds array access.
  • Predict: what’s the expected behaviour for hypothesised cause?
    • i.e., var i will exceed class.size() at some point.
  • Experiment: perform a controlled experiment to verify prediction.
    • Re-run an identical scenario in the debugger.