debugging: 5 tips to keep you sane

April 22, 2007

Debugging sucks. It’s a painful process that every programmer has to face at some point. Unless your are using an application that lets you walk through your script line by line, then it can be a pain in the pocket protector to find your error. Here are 6 tips that can save your sanity while debugging.

If your script isn’t working, make sure to look out for the basics before you have a heart attack:

  1. Declare your variables with descriptive names. This way at least you’ll know what your using and where/why it’s being used.
  2. Check your opening and closing tags. Every script has their own. Make sure that they open and close when they need to. This can be especially tricky when it comes to loops, so keep your eyes sharp.
  3. Make sure your passing the right arguments. Check out what’s being passed by printing the value on the screen. This way you are working with what you really think is really there.
  4. Check your syntax for basic misspellings. This means double checking the name of your functions, all it takes is 1 character to mess up a script. Make sure your calling calculateData(), not calculteData().
  5. Relax. If you can’t find your error, take a break and come back to it. There is no reason to get your panties in a bunch if you can’t find your bug. Unless of course your on a deadline, then you better get your ass to work and find your error.

If you still have script errors, search the net to see if anyone wrote code similar to yours. Better yet, check out Krugle.com. It’s code you can search. Check out their demo first so you can get started fast. Hopefully then your script will run nicely.
Happy programming!



  1. I’ve also found the Stop function in VB (I’m not sure what the equivalent is in other languages) very useful when looking for errors. It helps me to see what the value of each variable is at any particular point, so I can pinpoint where my code stops working in the way I want it to.

  2. Nice. On asp.net (and other high end builders), you can walk through the code line by line and see all the values to variables. It’s preety sweet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: