Debugging: The most important tool in your toolbox

 

I was prompted to write about this because of a great article written by a fellow Internet Specialist, Steve Gomori.  He took the same program that I did at the University of Winnipeg – Distance of Continuing Education.  The post deals with the Online Databases, Perl, and PHP Course.

He mentions that the “smaller”, “trivial”, or “baby steps” of the script are brought to attention and tested on a regular basis.  This I think is a critical phase that many educational programs and programmers leave out.  Planning and debugging your scripts are crucial aspects of any web application.  As one professor of mine has said, “There are many code monkeys out there for companies to hire, but what separates you from a high school programmer is your ability to plan, debug, and communicate your ideas effectively.”

Can any of you agree with the above statement?  Debugging, and testing every single line of code may seem tedious at first, but in the end will actually save you time.  Imagine writing 100 lines of code, just to find out that all you get is an error message.  Now you have to retrace your steps through a lot of code, instead of just last couple lines of code.

Below I have listed several helpful debugging methods/tools:

  • write a line or two of code, and immediately test.
  • if something is broken, comment out a section and try again. Keep going until you isolate the problem
  • output a variable to the browser, if you are not sure that it contains the proper value
  • use an IDE that allows you to set breakpoints, and walk through your code
  • create flow charts, storyboards, and database models (if needed) for your project
    • time planning at the start will save you time at the end

If you have your own debugging techniques and/or tools for programming, share them in the comments below!

Related posts:

  1. FirePHP: Unobtrusive PHP Debugging


Tags:

Written by Brenley Dueck

 

2 Responses to “Debugging: The most important tool in your toolbox”

  1. klang Says:

    October 23rd, 2008 at 6:14 pm

    Though having used all the methods you list, there is another one: making unit tests while coding.

    Yes, it takes time to write unit tests (but it’s coding, something we all know and love) but they sure are a nice tool to have, when something goes wrong ..

  2. admin Says:

    October 23rd, 2008 at 6:16 pm

    Yes. Unit testing is another part of testing and debugging your code. Something that should be done at all stages.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
connect with me!