Tips on Walking Through Code(Selected from by Adam Barr )

王朝other·作者佚名  2006-01-09
宽屏版  字体: |||超大  

The following is extracted from <<Find the Bug>> by Adam Barr.Although they seem trivial tips,yet they are quite useful.

These are the steps to take when looking at code. Keep in mind that, hopefully, you won't need to go through all the steps:

1. Split the code into sections with goals. Separate the code into smaller sections and determine what changes each section is supposed to make to the program's variables.

2. Identify the meaning of each variable. Figure out the logical meaning of each variable and note where it is used and modified.

3. Look for known gotchas. Do some quick checks of the code to look for some basic errors that can be found quickly.

4. Choose inputs for walkthroughs. Pick a good set of inputs to use when walking through the code.

5. Walk through each section. Carefully walk through the code, emulating each instruction in your mind and tracking what changes it makes to the variables in the program.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有