top 10 list of questions to ask when some code doesn’t work
Unfortunately I have never seen such a list. But I’m prepared to start one.
If you’re the asker
- find the “stupid question asker” and start explaining the problem to them.
You’ll realise your mistake quite quickly
- if you’re worried that that it could be a silly mistake, and not worth being awarded “the plank” if it becomes public, then start adding debug statements.
In the PL/1 days I used to write “put skip list” statements
In C you write printf’s or the equivalent macro or function call.
In my experience you’ll notice the problem the minute you’ve finished writing the debug lines, even before the code has been compiled and run.
- ask yourself the following:
has it ever worked
did it actually work last time
what have you done?
did you recompile the program
did you relink the program
did you actually change the program
are you running the program you thought you’d changed
are you looking at the right output
have you changed the inputs
does the code match the comments. if not, which is wrong
is it repeatable. if not, give up until it is
You can ask these questions in whatever you order you feel necessary and
as many times as you like until you find the solution
If you’re the askee
- do the google search that the askee should have done
- ask them if they have reduced the problem to the simplest version that exhibits the bad behaviour
- ask them if they have you compared the results with the most recent regression test
- ask them to repeat the problem on another machine
If you’re the “stupid question asker”, ask the asker
- “Can you explain it to me again?”
- “Are you sure that’s the problem?”
- “Does it make any difference what day of the week you run it”
- “Did you reload the data from yesterday’s dump”
- “Does it work on Windows?”
- “Would you expect it to work when ‘whatever’ is not available?”
If you happen to be the project manager you can add these
- “When will you have a fix for it?”
- “If this went into production what severity would it be?”
- “Do you have a work around?”
- Ask them if they have asked the expert. This is a particularly good question if you know the programmer IS the expert.
Originally published as “top 10 list of questions to ask when some code doesn’t work”.