Look before you leap!

Take almost any software application problem, whether using the Perl programming language, or any other, and you’ll want to fix it, probably quickly. The temptation will usually be to think your way around the problem, second-guessing what the issue might be, and trying a couple of quick-fixes, in the hope that the problem will go away. With a little luck, if you don’t see the symptoms any more, you can say you’ve fixed it.

You don’t know that, though. More often than not, the best way to fix a problem is to first LOOK at it. When you’ve SEEN the error, then you have a real chance of fixing it. And in hindsight the error/fix is almost always more obvious than you can quite credit.

This is not advice to suggest you don’t use your brain for bug fixing, but is most certainly advice to try not to make things more complicated than they need to be. Once you’ve identified the source of the error, only then can you reasonably expect to then use your brain to figure out a solid solution.

While this may appear obvious to you, I see it time and again that people don’t take the time to actually look into the problem, instead the first knee-jerk response is to go with “I know what that is, here, let me just fix it… oh, that didn’t work… strange”.

So, don’t try to be clever by guesstimating what the problem might be, first go take a look. David Egan’s most excellent book on Debugging has some excellent advice on this front. If you’re using Perl, you might use the print statement, or the built-in debugger (book), or even both, to first LOOK at the problem, before deciding what to do next, and how to fix it.

Find this content useful? Share it with your friends or comment below!

Leave a Comment