7.8.0.10

Debugging

unbreak things

Just in case none of your programming courses ever explained debugging in the context of systematically designed code, here are basic hints:
  • turn a failing integration tests into failingYou may need more than one. unit tests;

  • if a function/method fails its unit test, turn the failing test into unit tests for all the functions/methods that it calls.

  • eventually this "divide and conquer" method locates the bug in a narrow slice of your code. Focus on this "slice" for bug fixes.

If your methods "collude" to achieve a common goal, the "slice" may consist of two disjoint regions of code. You will need to understand the logic that connects those and figure out the fix from there.

In other words, systematic debugging is just like systematic coding. It sounds like it takes extra time but in the end it will save you time because you’re guaranteed to get to the goal.