Tuesday, September 8, 2009

What To Do When You Find a Bug in Your Program

No Go Answers
If possible pretend that you are the company's answering machine. "You have reached Acme LTD, we are sorry but all the support lines are busy. Please call back in 12 hours".
Answer that you are sorry but the line is lousy and you did not hear the last sentence. Blib, zzp, blip. "Could you please call us back tomorrow, or when the lines are fixed?".
Answer that you are sorry but the support team is on holidays and that they will be back in no time, in 3 months.
Answer "I do not care, leave me alone, its Friday. You asked for the application now learn to live with it".
No Go Doings
After you have reproduced the steps and actually found the bug:
Introduce new, more severe bugs. The bug from the phone call will look like child's play. When this new bug is found, introduce another one. Just keep adding more bugs.
Ignore the bug. Just continue adding extra functionality to the application. Maybe users will forget and never again run into it.
Restart your development environment. If that does not help restart Windows. If that does not help restart Windows again.
Locate the line of the source code that is responsible for the bug (note: this requires lots of your valuable time). Then do one of the following (or all):
Delete the function containing the line of code that produces the bug. If you remove the cause - the consequence (bug) will go away. If, for example, the result of the function was a Boolean value, just make sure that sometimes false is returned and sometimes true is returned for the function result.
Turn your head away from the monitor. Pretend that you are dead. Maybe it will go away.
Turn your head away from the monitor. Pretend that you are dead. Try to scare the bug by quickly looking into the source code saying "bu". Repeat until the bug is gone or the code fixes itself.
Delete the application source. Delete any marks the application ever existed. Pretend that you never created the program in the first place.
Run. Run as fast as you can.

No comments: