Contribute article - "to give the beginner five debugging tips"

Programming Debugging 

Csdnstudent

AdministratorCSDN University

Editor's lead: programming is a happy thing, can see the realization of the function of his thought a and a, experience such as lead or magical pleasure. But debugging but always can let us into deep remorse, rumination, and worry, sometimes small problems also may let us become confused, collapse. A little bit far away, ha ha, here I'll share some of the time you might use the five tips in debugging.

1 you are very likely to "spelling mistakes"

Hey, some small partners in the mind must think how to put this compiler can find out the things in the first place? No level!". The spelling error here is not the object name or keyword that is automatically detected by the environment. It is the object of your own definition of the same name and the same name.This is more likely to occur in the environment where it is spelled, and it's hard to detect.

How to solve this problem? Of course at the time of the time to pay attention to check is the best, the source can be resolved. If such as other key object attribute strange, weird array length, reported abnormal number of rows of outer can watch one by one to exclude the inventory, very may solve the problems appearing in the debugging.

2 abnormal not only to bold capture but also bold follow-up

In the C++ program debugging is very easy to occur when the program can not go down to the exception, be sure to follow the bottom to see the stack, so even if you do not understand the underlying mechanism can also provide some of the characteristics of the problem.

In addition, the abuse of catch try statements is not responsible for the program. Exception thrown must be a layer can be resolved, otherwise the overall impact of the entire software is difficult to measure the impact of the entire software.

3 you need to hand written "association list"

When our exception information is pointed out to us, we are not clear about the place where we feel the wrong place, you need to hand out all the objects, arrays.This can not be silly, but in order to clear headed, in many cases monitoring "objects" is not necessarily wrong, but through your calm again after writing, is likely to had a brainwave, aware of possible other variables associated with cheek by jowl.

4 a picture wins a thousand words, a table forever

The problem is that I get the experience of learning data structures, many cases, the more complex, especially the data structure is to do it.Also in the process of drawing and it's likely that you'll think of improvement on the structure of, because your face is not the cold code but vivid drawings.

Table is another tool to solve the problem, small partners know that in our VS2010 debugging time there will always be a variety of dynamic, which often makes us very happy. But sometimes we have to draw a small table, of course, is not to do such a monitoring work, but to help us analyze the multi attributes and multi function object, we can use similar UML writing to the object one by one to eliminate the need for "upgrade".

5 to unremittingly, Sike in the end. To be good at communication, divergent thinking.

A lot of comrades have such experience "treat bug must be severely punished and then quickly, will not be tolerated!"This is of course very right, and it will help us to be better and better. But have we addressed this into the world to have a star was born heart ah, we can easily when impatience into a solution, and this solution is likely to is that early slightly to see the results, and then increasingly stretched type.So when we have a problem, first do not rush to go to war, try to listen to the views of heroes, in a way to try to have the possibility of failure started another scheme, betting behavior is not desirable.

Well, that's what I want to share with friends, of course, the code is continuing, and my life is continuing. Finally, to give you a word of encouragement: "for survival, procedures for death, a lifetime struggle for Debug!"

 


Article author: Yanshan University 13 software engineering 3 class Lv Heng

Welcome to contribute.Http://prog3.com/sbdm/student/mcd/topic/163587/1149217

Establish
2015-03-09
Browse
2848 times
Latest reply
2015-03-09
Reply
0
Zambia
Four
Top_arrow