Visualization Tools User's Guide


Example: Using the Object Visualizer

To see how the Object Visualizer displays object activity, try the following example.

We will examine the behavior of the sample application VtExampleApp, an application which does some simple graph manipulation.

Note: You can follow the steps below, and get a feel for using the Object Visualizer, even if you are unfamiliar with graph theory and don't understand what the example application is supposed to do. In fact, even though you are just a casual observer, you may gain a bit of an understanding of the coarse structure of the application's behavior, just from this very brief visualization session!

  1. From Visualization menu of the system transcript select Open Object Visualizer. An Object Visualizer window will appear.

    Figure 1.



    Object Visualizer window

  2. From the Class menu of the Object Visualizer, select Add Classes.... An Add Classes window will appear.

    Figure 2.



    Add Classes window

  3. Scroll the Applications column down, and select VtExampleApp. The Classes column will fill with the classes of the VtExampleApp application.
  4. Select VtExampleItem and VtExampleList in the Classes column.
  5. Press the >> button. The two classes will move from Classes to Selected Classes.
  6. Press OK. VtExampleList and VtExampleItem will appear in the Object Visualizer's Classes column.

    Figure 3.



    Object Visualizer with example classes

    Note: When you first open an Object Visualizer, there may already be some classes listed in the Classes column. This is because the Object Visualizer remembers which classes were being visualized in the previous session and restores them at the start of the next session. If you wish, you can remove such classes by selecting them and choosing Remove Classes from the Class menu.

  7. Open a new workspace, e.g. by selecting New from the File menu of the System Transcript, and resize it to be fairly small.
  8. Arrange the windows on your screen so that no other windows overlap with the Object Visualizer window. Shrinking the workspace to barely reveal the text that it will contain is a good idea.

    This example concerns a VtExampleList, a slightly random graph of VtExampleItems. During the setup, the items figure out which ones are successors of each other. This can be seen quite clearly as follows.

  9. Evaluate the expression VtExampleList new: 8. Watch the Object Visualizer. A VtExampleList will appear (a divided blue box), and then a stream of VtExampleItems (more divided blue boxes).

    The VtExampleList will then send a message to each of the VtExampleItems. As each message is being sent and the corresponding method is being executed, a line appears between the two boxes that represent the sender and receiver of the message.

    Then each VtExampleItem will send a message to each other VtExampleItem in turn.

    In the next step, you will see that this behavior corresponds to initializing the items of the graph, and then computing the successor sets of the items, to connect the graph components.

    Figure 4.



    Object Visualizer with Example Instances

  10. Select the VtExampleList instance by clicking its center. A thin black border will surround it, indicating that it has in fact been selected. Then select Browse Behavior from the Instance menu of the Object Visualizer.

    A window opens showing the methods that have been active for that object. For each method, there is a count of the number of times it has been invoked, and the amount of time that has been spent executing that method. The color of an entry provides a relative indication of how active the method has been.

    The browser shows that VtExampleList>>initialize: has been the most active by far.

  11. Open a behavior browser for the first VtExampleItem instance as well.

    This browser shows that VtExampleItem>>shouldConnectTo: has been most active of the VtExampleItem methods.

    If you want to understand the program execution more fully, open browsers on the application code, the methods VtExampleList>>initialize: and VtExampleItem>>shouldConnectTo: in particular, and see how the activity observed in the visualizer corresponds to the code.

  12. Close the behavior browser windows opened above.
  13. In the workspace opened earlier, evaluate VtExampleList the bubbleSort. Observe the behavior of the bubblesort computation, as the VtExampleList repeatedly asks the items to compare themselves with other items.

    Figure 5.



    Object Visualizer Bubblesort

  14. Reset the visualizer display by selecting Reset from the Options menu.

    The boxes all become blue, as they were when they were first created.

    Now, we will visualize a rather crude breadth-first search, looking for a "heavy path", that is, one whose total heaviness is more than 10,000. (See the code for the exact definition; but note that the example is contrived for illustration rather than realism.)

  15. Evaluate
    (VtExampleList the heavyPath: 10000 depth: 6) inspect
    

    .

    Watch as one VtExampleItem experiences a great deal of usage, a few others get some usage, and the rest are untouched. The heavily used node is the first one in the (sorted) list; the other heavily-used ones are presumably its successors. The heavy use of a few list items suggests the need for some improvements to the algorithm.

    Figure 6.



    Object Visualizer Usage

  16. If desired, slow the visualizer down by choosing the command Set Delay Time from the Options menu, and setting the slider to 1. Rerun the visualization by evaluating the heavyPath expression again. You can see the paths from the root of the search.
  17. End the visualization session as follows. Choose Select All from the Instance menu of the Object Visualizer, and then choose Remove Instances from the Instance menu. Then choose Select All from the Class menu, and choose Remove Classes from the Class menu. Finally, close the Object Visualizer window.


[ Top of Page | Previous Page | Next Page | Table of Contents ]