1 / 9

Debugging Watch and Text Output

Debugging Watch and Text Output. Alice. 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. Watch.

jacob
Télécharger la présentation

Debugging Watch and Text Output

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 is going 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 • Every time the value changes, it is immediately updated in the window. • Setting a watch on a variable thus 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. Demo:Creating a print instruction

  8. Modified methods • Here is the modified left method: • Note that a print instruction is added to both the left and right turn methods.

  9. Demo • The major difference between a watch window and text output is that text output provides a history of the values as the program runs.

More Related