dubai

Saturday, April 23, 2011

How to Hand Trace Through Software Code

One valuable way to test your software code is to trace it by hand, or desk check it. Desk checking can help you spot errors in your algorithm or approach that may not be obvious when you simply run the program on a computer. To trace code by hand, you must meticulously keep track of the details of the code

  • 1
    Find all the relevant variables and conditions in the code. You should take note of anything that can change during execution or that can have an effect on the output of the software.

  • 2
    Make a table with all of the relevant parameters listed either along the top or along the side.

  • 3
    Select appropriate input data, if necessary. If your code requires user input, choose data that is representative enough to adequately test your program. Make note of what the program output should be for this input.

  • 4
    Perform each step of the program for the input data you selected in Step 3. Use the table to keep track of changing values as the program progresses. You may want to use one row (or column, depending on how you set up the table in Step 2) for each instance of a loop or for each pass through the code.

  • 5
    Compare the results of your hand trace with the expected results for the input data. If the results match, then your code is successful for that case. Otherwise, there's a problem with your code.

  • 6
    Repeat Steps 3 through 5 (and Step 2, if you need more room in your table) until you get correct results for a representative set of data


  • from - http://www.ehow.com/how_2266754_hand-trace-through-software-code.html

    No comments:

    Post a Comment