Debugging is the process of figuring out why a series of events that apparently should have led to X did not. I recently came across an interesting page devoted to Algorithmic and Automatic Debugging. Just the sheer number of links on the page shows how much we poor humans need debugging assistance.
Sometimes, program failures are simple failures of knowledge: either we don't understand the language we are using or we don't understand some structure or underlying hardware that our programs are working with. That's probably where debuggers are most useful: if we expect X to have value Y at some point in our program, a debugger (or even just a well placed "print" or "assert" macro) can help us find out why it had some other value instead. But the really unpleasant failures come from logical or algorithmic failures: we're checking under the candy wrapper trying to find an elephant. It's not going to be there no matter how "correct" our program is at lifting up candy wrappers and recognizing trunks and tusks thus exposed. Those are the programs that are really hard to debug, because there's nothing necessarily wrong at all except for the implicit assumption that an elephant can be hidden under a candy wrapper.
Humans vary widely in their ability to "debug". The skill is really no different than that portrayed in any "detective" movie: you gather facts, apply logic, and figure out what must be happening. With program debugging, you often have the advantage of being able to replay a situation with different conditions, which may give you more clues as to the problem. For example, if a computer seems to be totally dead, plugging it into a different wall outlet or plugging a known working device into its outlet might immediately solve the problem. For most of the people reading this, that kind of testing (and more) is pretty obvious, yet I am continually amazed at how many people can't come up with logical test procedures by themselves. It's not lack of intelligence necessarily; I've seen horrible debugging skills in people I think of as extremely bright - people who ARE extremely bright by any other measure, yet become helpless when presented with situations that would be trivial for many of the "geek" types apt to be reading this.
See Basic Troubleshooting also.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2012-07-17 Tony Lawrence