Can You Reliably Reproduce the Bug?
Quick reminder that my next webinar will be one week from today, covering a repeatable method for debugging web applications. See you there?
Yesterday I talked about the importance of starting your debugging process by clearly articulating the bug. This is the first step to a clear understanding of the defect. The next step, and what I want to talk about today, is that you need to be able reproduce that bug reliably. There are two reasons that this is crucial.
First, if you can't reproduce the bug at will, then how will you know when it's fixed? Did the change you just made fix the problem, or did the bug just not manifest this time around? You could re-execute five or ten times to feel a little more certain, but boy that sounds tedious. And are you sure that it wouldn't have manifested on the 11th try?
The second reason is that if you can't reproduce it at will, then you don't really understand what's causing it. If you don't really understand what's causing it, then you are more likely to ship a band-aid fix than a root-cause fix. Intermittent bugs are often indicators that something below the surface needs some attention.
Articulating and reproducing are very tightly intertwined. As you ensure that you can reproduce the bug at will, your description of it will probably evolve. This is a good thing! It means that you're gaining deeper understanding. As you refine your understanding and description of the problem, you're going to starting having ideas about what the cause might be. RESIST THEM! Remember, theories are expensive. It's not the time for theories yet. You want to find where the bug is occurring before you figure out why.
Tomorrow I'll talk about how to pin down exactly where in your code things are going awry without having to trace line by line.