Unfortunately, due to the extraordinary diversity of application areas, there is no cookbook solution for programming tasks. However, there are a few useful tips that you could employ almost universally when solving a problem on a computer:
|
When you are building your program, distinguish and keep track of the following activity phases:
|
While first meaning of debugging is to remove errors, it's real meaning is the ability to see the execution of the program. When you are creating a program, you are making many assumptions about its execution. This is a necessity, since it is impossible to see what program will do before it is written. Some of your assumptions could be wrong, and will result in code errors. Even if the code compiles, you might get a strange behavior at run time. Solution to this problem is to add visibility of the execution, gain control, find precursors to the problem, and, finally, remedy the problem. OK! You found a problem, and now is the time to fix it. However, remember to make one change at a time. Do not attempt to change too many lines of code at once. "One change at a time" is the only known scientific approach to manual debugging! Take a break when you have to! Communication is advanced programming skill, so ask for help if you are getting stuck on an unexpectedly stubborn problem |