Today in Oschina saw the debugging skills, indeed for debugging very helpful, and most of us have not used, we often use the debug is F5678 four keys, if you want to improve the debugging efficiency you can try to use, write code to do the project people know debugging is a headache , sometimes a small problem will also waste you a long time, if you do not want to debug the above charges too much time, you can use the shortest possible time to find out the cause of the problem, you can start from the debugging skills, flexible grasp debugging skills of people will greatly improve the development speed and efficiency.
Like life out of all kinds of problems need to be resolved in a timely manner, different things to find different solutions, find the key to the problem, you can say a debugging person is also a person who will live, he (she) know how to adjust life, let life just meaning.
Simply try these several ways to debug, or it is very easy to use the usual people can be more attention to the commissioning process, practice, as long as the use of more will also be skilled.
Logical Structure
This debugging is mainly used in some variables of the logical structure, such as map, array, collection, etc., I do this project from the foreground to the backstage is all the map, the data from the background is also all map is structured data, so, the application of this debugging is very intuitive, The following two graphs are compared in the fee logical and logical views:
When you do not use a logical view, the data in the map is sorted by key-value pairs if more than one will look uncomfortable, want to find the data you want to look at the 1.1-point queen to find very stacked, and then look at the logical view
Logical view can not only give a bunch of data, but also give the Key/value way, clear some.
Conditional debug
Conditional debugging is to write a condition at the breakpoint, if the condition is true at the breakpoint will stop, otherwise it will skip the breakpoint, combined with debugging example test:
Here is what I gave a condition is: newid = = 24, in the first logical view, you can see that the ID value equals 24, stating that the condition is true, the program will stop here. Note that there are various types, newid are shaping variables if a string comparison is an error, note the type when writing the condition, otherwise it will prompt the error.
Exception Breakpoint
What is the purpose of our commissioning? In order to find and solve the errors in the program, software engineering is said to solve the discovery or not found errors, the exception breakpoint is in the occurrence of abnormal place to stop, do not need you to find out what is abnormal, it will encounter abnormal stop in the exception, here you have to set the type of the exception, that is encountered what abnormal stop, I set a divisor of 0 for the exception that will be paused at the divisor of 0, as follows
expression and display windows
These two windows we are not unfamiliar a bit like the VB inside the Immediate window, in the window input expression can appear structure. For the display window, get the value in map
The following is expression, the result is the same
These debugging skills I tried all pretty good, for the necessary debugging added some efficiency, debugging is also with the complexity of the code slowly change the fine, first of all, the need for coarse-grained debugging guessing the scope of the problem and then narrow the scope, gradually shrinking, more and more hours will use the above these very subtle debugging skills, Some may start to use instead will spend more time, it is also quite normal need to repeatedly in the debugging to know and exercise in order to form a sense of application.
Gradually form the use of these awareness in the future without thinking or considering you will do so, so to apply, learn from the heart, many of the formation of consciousness will be repeated reminders and do the process of forming, such as safety awareness, eating awareness and so on, such as just under the rain, when you walk on the roadside next to the car from your side, Cheap to you some water, the next time you encounter this situation, even if there is no car you will walk in the road, now I love to walk in the road, a sense.