Aug 032013
 
 August 3, 2013  Posted by at 9:53 am Not So Stupid Questions  Add comments

[To celebrate my first year of programming I will ask a ‘stupid’ questions daily on my blog for a year, to make sure I learn at least 365 new things during my second year as a developer]

iris classon - how should I debub?

Debugging is a skill, and a skill I get to work a lot on. A few times I’ve been asked how I debug and locate errors, and I’ve had many interesting discussions about that. I’ve learned how to debug through experience, books such as Code Complete 2ed (has a great approach to debugging and I’ve adopted some of it, although I have to admit my flow is a little bit different), colleagues and courses.

Here is my approach (more or less) and I like to divide into question, action and how

Question:
What is the error?
Action:
Reproduce
How:
Messages:
–          Error messages
–          Log messages
–          Test messages

Next question:
Where is it?
Action:
Pinpoint
How:
–          Recent changes (commits etc)
–          Top down tracing
–          Try to isolate the area

Questions:
Why the error?
Action:
Create theories, get help with theories
 How:

–          Make up some ideas/theories
–          Discuss with colleagues, forums, social media
–          Keep in mind recent commits/changes

Then decide the best solution after making sure I
–          Really know the error
–          Where it is
–          And why it exists

  2 Responses to “Ask Iris: How do you find and debug errors/bugs? (Q 225-226)”

  1. Hey,

    I think this is a great approach to find bug/errors. In my job as a developer i have several situations where the “Discuss with colleagues, forums ,social media” is often the breakthrough in finding the cause of the bug/error.

    /A

  2. Knowing ALL of this after only one year of learning?

    I feel so inadequate.

    the way i debug:

    (1) avoidance: plan well. AND

    (2) write code one line at a time and constantly check.

    (3) write tests to constantly check.

    (4) view the stack trace to see where the error was – why it happened.

    that’s how i do it.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

What is 4 + 15 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)