Thursday, September 25, 2014
The Unexpected Bug
Of course all bugs are not the same. Some are irritating, slow down or hamper performance, or just do something wrong that only you, the developer, can notice. All of these may trigger a hunt for the culprit, but usually can be cataloged, recorded, and ignored when initially found*.
The bug that always gets the attention is the one that you did not see coming. You are working your way through some test cases or running the code to see how your latest changes perform and POOF! You app drops out and your debugger really has no clue why. Well, some clues, but not enough to find the exact spot of the problem. After your initial shock that the tools have failed you, you start wondering what caused the crash? Can I recreate this crash? Luckily, apps are not huge software programs, so getting back to where it crashed is usually pretty simple. If it crashes again, great! You have now found the problem area and are much closer to finding the root cause. If it doesn't crash, you now wonder if you recreated it right or have a more subtle problem in your code. (My C developer hat is shouting, "Check your pointers!")
Now the catalog process begins. If you can recreate it, chances are you can find the problem area and fix it on the spot. If it is too big to fix, it can be logged as a TODO for the future. Now you have to try to avoid doing that crash sequence until the fix is in, but sometimes it can wait. Most of the times, it can't wait because it could be the symptom of something more serious in the your code. Either way, it will take time to uncover, document, and fix. This is the programmer's 'padding' when trying to estimate a how long a program will take to write. If you mess up too much or don't get the design right initially, you can blow up your timeline pretty quickly. The padding in your estimate allows smaller delays and bugs to be fixed without the stress of a missed deadline. Of course, if you do finish early, then you can add some extra features. Win/Win!
On the other hand, a little extra testing might be a better way to use up that extra time. You never know what might happen.
* Now that last statement depends on who found it. My friends that perform testing on software will often disagree on the priority with the programmer. They are usually right, as they are closer to a customer than the programmer, but priorities are sometimes tricky.