This section contains 272 words (approx. 1 page at 300 words per page) |
Hand tracing is a technique that is used to verify algorithms in object-oriented programs such as Java. The technique follows the execution of programs in detail, line by line, with respect to code. In addition to revealing errors in the writing of a program, hand tracing can be used to understand how a Java program works.
With hand tracing, the execution of a program code is "walked through" to check its correctness. This process can literally involve dividing a piece of paper into categories and recording information under the appropriate headings. For example, the left side of a page can be used for memory cells and the right side of the page can be used for functions. Each function is aligned underneath the corresponding argument of the statement that calls for the function. A horizontal line separates different functions.
Alternatively, a program can be hand traced by the use of diagrams. Every method is represented by a rectangle and every object is represented by an oval. Each oval is labeled according to its class or its contents. Eavery reference is represented by a small rectangle within the larger rectangular method to which it is associated (or, to the method that declares it). Finally, every reference has an arc that connects it to the object that it references.
Hand tracing is useful in revealing normal logic errors. By keeping a running tabulation of the program variables and how they change during their use, and by comparing this pattern with the pattern in the computer, a difference may be revealed. The difference is a potential source of the logic error.
This section contains 272 words (approx. 1 page at 300 words per page) |