Local debugging
Debugging locally means exposing and fixing a problem once we have a local reproduction.
The basic steps of debugging are reproducing the problem, knowing what the current, incorrect result is, and knowing what the correct result should be. With that information, we can start debugging.
A great way of creating the reproduction of the problem is with a test, if that's possible. As we saw in Chapter 10, Testing and TDD, this is the basis of TDD. Create a test that fails and then change the code to make it pass. This approach is very usable when fixing bugs.
Taking a step back, any debugging process follows the following process:
- You realize there's a problem
- You understand what the correct behavior should be
- You investigate and discover why the current system behaves incorrectly
- You fix the problem
Keeping this process in mind is also useful from a local debugging perspective, though at this point...