x
Loading
 Loading
Hello, Guest | Login | Register

Debugging Web Applications

To debug Perl applications — even Web applications — just follow Randal’s three simple rules.

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.
I’ve learned over the years to write applications in very small increments, running the code after writing a few more lines, so I’m constantly in a “write-run-write-run” cycle. This strategy ensures that I never out-code my ability to understand the program I’ve written so far. Don’t write thirty lines of code before an initial run. When the code fails, how…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace