Gettin’ the bugs out

George V. Neville-Neil has some very good advice on debugging and development in general.

The relevant excerpts read:

The first is that I included the output of all the commands I ran – in fact, far more than is shown in this example. Keeping the output around for re-reading later is like making sure you have all your specimens in specimen jars. As we all know, rerunning the same test on a given piece of software does not always give the same results, and thanks to Murphy’s law, the more you need the test to be repeatable, the less likely it will be. Save your output.

The second point to consider is that I record and keep all the hypotheses, including the incorrect ones. Attempting to re-create your state of mind during a previous debugging session, without the use of mind-altering substances, is even more difficult than rerunning the test code and getting the same results. There is nothing to be embarrassed about when you get one of your educated guesses wrong; that’s how science works. You make a guess, based on what you know or think you know at the time, and then you test it. Keep all your hypotheses.

Lastly, I explain what I fixed. Just because your test passes or your code doesn’t crash doesn’t mean that you have completed your debugging. It might be that your fix hides the problem, until some other issue causes the bug to resurface. If you don’t remember what you did to fix a problem, then when you see the same problem again you won’t remember how you fixed it, and that is going to suck. Take notes on the cure, as well as the disease.

I feel that this advice is applicable to both debugging and development. I would say that about half of what I try in development does not work for one reason or another, and I would say that this is normal. Keeping logs will help you to see what has and has not be tried before, what and why it failed.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: