Debugging Web Applications
To debug Perl applications — even Web applications — just follow Randal’s three simple rules.
Thursday, December 15th, 2005
I’ve spent a fair amount of time over the past decade debugging web applications and even longer before that debugging programs in general. I’m occasionally asked about my strategies for debugging (especially because they seem to be a bit radical at first glance), so I thought I’d take a moment to share my techniques with you.
First, “debugging” is literally “removing bugs.” But the term is also used to describe the varied and important tasks of making a program run on more platforms, run better, or run faster. People like to run applications in a familiar enviroment, and expect that if a program produces some answer, it’s a correct answer provided in a reasonable amount of time.
Keeping the Bugs Out
I’ve noticed that I generally fall into a foul mood after debugging for an extended period of time. This leads me to the conclusion that debugging should be avoided if at all possible. But how?
The first rule of debugging is: Don’t put bugs in. While that may sound flippant, it’s actually simpler than it sounds, at least if you adopt the right development strategies.