I’ve been thinking about writing an article on the sad realities of debugging a program and the effect that it has on us barely human programmers. Then I came across this post at 4 Lines of Code. It’s genius and I love it and it is all perfectly true. Somebody should be collecting these pearls of wisdom from blogs and making a book. Seriously.

We have examined earlier the fundamental laws of bug finding. You will probably know the fundamental stages of bug finding. The 6 basic stages of debugging are well-known among programmers and can be found in various blog posts. During debugging, developers and programmers go through a cycle of emotional states:

  1. DENIAL. That can’t happen.
  2. FRUSTRATION. That doesn’t happen on my machine.
  3. DISBELIEF. That shouldn’t happen.
  4. TESTING. Why does that happen?
  5. GOTCHA. Oh, I see.
  6. RELIEF. How did that ever work?

First (1) we have a stage of denial and surprise: you say that the bug isn’t possible, that it can’t happen, because you have not observed it before. You are surprised. The reason is (2) that is doesn’t happen on your machine or on your computer. You can not reproduce it instantly, and you have not seen this bug before. You get frustrated and sometimes a bit angry. Therefore you think that (3) it shouldn’t happen. Yet someone – unfortunately often a customer or a user – insists that it does. So you (4) ask why it is happening, and why it can happen. The only way to solve this problem is to find out what really happens. You start to examine logs and to debug the program, until you are able to find and to reproduce the bug. If you’ll do this long and hard enough then (5) you see the reason for the bug, and are able to remove it. You are trying to reproduce the bug again to see if it is fixed. Finally (6) you ask yourself how it ever work before. The longer you seek a bug and the longer the phases (1)-(4), the larger the relief in the end.

You can read the original post here: http://4loc.wordpress.com/2010/03/13/the-six-stages-of-debugging/

If you’re into development at all, be sure to check out 4 Lines of Code, it’s good stuff.