Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debugging Watch and Text Output Alice. Debugging Techniques Several techniques are helpful in eliminating errors (bugs) in programs: careful design incremental.

Similar presentations


Presentation on theme: "Debugging Watch and Text Output Alice. Debugging Techniques Several techniques are helpful in eliminating errors (bugs) in programs: careful design incremental."— Presentation transcript:

1 Debugging Watch and Text Output Alice

2 Debugging Techniques Several techniques are helpful in eliminating errors (bugs) in programs: careful design incremental development In this session we look at two additional techniques: Watch Text output

3 Watch Variables are elusive and a bit magical because they exist somewhere in the murky depths of the computer's memory and we can't see what goes on inside them. To help you "see" the inner workings of a variable, Alice provides a watch -- a small window where the value of a variable can be displayed at runtime.

4 Creating a Watch Select the object in the Object tree and then the variable you want to watch. Then right click on the variable and select watch this variable. In this example, we selected the corvette and then right clicked on its direction variable.

5 Demo Ch10Lec3DebugWithWatch Concepts illustrated in this example A watch can be used to display the value of a variable every time the value changes. Setting a watch on a variable allows you to see whether the value is changing as expected. If not, you can then change your code to make it work correctly.

6 Text Output Using a print instruction is another way to keep an eye on the value stored in a variable at runtime. The print instruction causes the animation to be displayed in a split window. One pane displays the animation A second pane is a text console where text output is displayed.

7 Creating a print instruction

8 Demo Ch10Lec3DebugWithPrint Concept illustrated in this example A print instruction activates a text console and displays the variable value each time the method is executed.

9 History The major difference between a watch window and the text output provided by a print instruction is that text output provides a history of the values as the program runs.

10 Assignment Read Tips & Techniques 10, Debugging with Watch and Text Output


Download ppt "Debugging Watch and Text Output Alice. Debugging Techniques Several techniques are helpful in eliminating errors (bugs) in programs: careful design incremental."

Similar presentations


Ads by Google