View this PageEdit this PageUploads to this PageVersions of this PageHomeRecent ChangesSearchHelp Guide

Object Instance Visualization Tools

This is a WIKI page for Object Visualization Tools.

Team Members:
Thuc Si Mau Ho
Tam Pham
Michael Green
Henry Saputra


Contents


Project Proposal
User Stories
Installation Notes
How to Use the Tools and Run the Demos
Class Diagram
Patterns Used
References


Project Proposal: Object Visualization tool


Looking at the object structure and object interactions at run-time is a good way to have an insight understanding of an object-oriented program. Our project aims at building an Object Visualization tool that can be integrated into the Squeak environment. The tool can be useful for designing and implementing (and debugging) a program using Squeak Smalltalk.

Two basic usage scenarios of the proposed tool can be described as follows.

Suppose we take a snapshot of existing objects in an executing program at some moment of time and display them in a view. Since We'll have a very large set of objects we have to organize them somehow, limit them in numbers, classes or so. In short, we pick up a subset of objects of interest. Then, we will trace the message passing between these objects until another moment of time in the future, or when some result is achieved.

All of these have to be done automatically, which means the diagram will be generated on-the-fly. The user can have an options to decide which objects are incldued in the diagram and which messages will be traced. The object diagrams will be displayed using UML standards.

A specific usage of this scenario is to take the snapshot when a test case method begins to execute and monitor the object interactions until the end of the test method. By this way, we can have a visualization of the running of a test method.

In the second scenario, the user will create a new object or pick up an existing one and invoke a command to display the object visual inspector. The tool will display a view where the internal structure of the selected object can be visualized, i.e. how the object is composed of other objects and their state values will be depicted. The object visual inspector will monitor and display the dynamic changes in the object state as well as its interaction of other objects of interest.

In fact, both scenarios are ways to limit the number of objects under focus in display.

The object diagrams can be used for analysis in many ways. One possible analysis is to pin-point the objects that correspond to a particular pattern.

We hope the tool can be useful in understanding the object run-time structure of an OO-program, as the following quotation from the Design Patterns book:

"An object-oriented program's run-time structure often bears little resemblance to its code structure. The code structure is frozen at compile-time; it consists of classes in fixed inheritance relationships. A program's run-time structure consists of rapidly changing networks of communicating objects. In fact, the two structures are largely independent. Trying to understand one from the other is like trying to understand the dynamism of living ecosystems from the static taxonomy of plants and animals, and vice versa."

Last modified: March 14, 2005

User Stories


Very High priority : need to implement
High priority : very interesting/desirable to have it implemented
Medium priority : can be implemented if time permits
Low priority : additional things

1/ Snapshot. Priority: Very High
1.1 Install the Snapshot Manager for a chosen set of classes/methods to be monitored
1.2 The Snapshot Manager is activated
1.3 Object instances of monitored classes are displayed
1.4 Messages sent between monitored object instances are traced and displayed
1.5 Messages sent between monitored object instances and non-monitored ones
are traced and displayed
1.6 The Snapshot Manager is deactivated
1.7 The view inside Snapshot Manager is manipulated: grouping, decorating, saving, reloading ...

2/ Visual Inspector. Priority: Very High
2.1 Install the Visual Inspector so that it can be accessible from system menu
2.2 User invokes the VI for an object
2.2a User configures the VI through an UI property page
2.3 VI displays the internal structure for that object visually
2.4 Messages between the internal objects are monitored
2.5 Messages between the object and other (external) objects are monitored
2.6 The view inside VI is manipulated: selecting, grouping, decorating, invoking other VIs, saving, reloading ...
2.7 Object is destroyed ???

3/ Pattern pinpoint. Priority: Medium
3.1 Objects cooperating in a specific pattern are pinpointed (recognized automatically or manually)
3.2 Pattern objects are displayed with adornments: colored, collapsed or expanded

4/ Selection of monitored objects. Priority: Very High
4.1 User selects group of classes whose object instances will be monitored
4.2 USer configures how the views are displayed
4.3 TBD: Allow methods (or groups of methods) to be monitored separately
4.4 Allow separate objects in the VI to be monitored

Last modified: March 21, 2005

Installation Notes


Use the Monticello Browser to load the project code presented at the MCFtpRepository with host: 'swiki.cs.uiuc.edu' and directory: '/home/proj05/visual'. A preconfigured Squeak 3.7 image is also available here: object visualization final.zip

Please use only the versions with 'Final' word added at the end for grading. The following packages will be needed to install in that order:

1. AspectS-Aspects and AspectS-Wrappers: contain support for Message Wrapping. Note that these packages modify some system classes.
2. CS598rej-Project-Model, CS598rej-Project-View: contain the project code base.
3. CS598rej-Project-Test: contain test cases and test support classes to demonstrate the behavior of the project tools.
4. CS598rej-Project-Menu: contains UI support for the Visual Inspector tool (integrates the tool into the Squeak environment).
After the Menu package is loaded, execute ParagraphEditor initializeTextEditorMenus in a Workspace or any other text window


How to Use the Tools and Run the Demos


Visual Inspector

You can do one of the following:

1. Execute the following piece of code:

| object model |
object := TestClass1 new.
model := VIModel openOn: object.
VIView openOn: object with: model.

2. Run the test cases VIViewTestCase01 and VIViewTestCase01a
3. Use the modified Squeak world menu by
3.1 Highlight an object of Smalltalk code in a Workspace or any other text window
3.2 Select "visualInspect it" from the pop-up menu.
Alternatively, you can send to the object you want to monitor the message visualInspect.

This will open a Visual Inspector window on this monitored object , with the object's instance variables displayed as small rectangles. From this point onward, messages sent to or from the monitored object or any of its internal objects will be displayed on the Visual Inspector window. Messages from the outside sent to the monitored objects will be displayed on the diagram as arrows from outside to the monitored object (these arrows appear at the top of the diagram). Messages sent between two internal objects will be displayed as arrows from the message senders to the message receivers

Please note that bydefault the classes contained in categories beginning with the following are not monitored (with exception for class Random): Kernel, Collections, Graphics, Tools, System, AspectS, CS598rej-Project-Model, CS598rej-Project-View.

This restriction is enforced as these classes are so common that the user will not be very interested in messages from/to these classes. Hence, eliminating these messages will enhance the presentation of the diagram in a more useful way.

Snapshot Manager

The Snapshot Manager needs to be configured with a proper context to run.

Run the test cases VIViewTestCase02, VIViewTestCase03, VIViewTestCaseBuilder, VIViewTestCaseStrategy to see how it works.
VIViewTestCaseBuilder and VIViewTestCaseStrategy testcases demonstrate the visualization of object collaboration
in Builder and Strategy patterns.

A Snapshot diagram will be displayed. From this point onward, any messages sent between objects belonging to monitored classes will be displayed.

You can also click on the ObjectShapes in the diagram and choose 'Visual Inspect' to display the Visual Inspector on that object.

Change the default delay time parameter in ViewMorph>>defaultDelayTime to see the slower animation of message passing.

As an example we include here the screen shot of the visualization of objects interacting following the Visitor pattern (from Design Patterns [GoF] book).

Uploaded Image: VisitorPatternVisualization.JPG

Last modified: May 14, 2005


Class Diagram


Uploaded Image: ClassDiagram-0501.JPG


Patterns Used


The following patterns are used in the project design.

Observer

Abstract classes VIModelAbstract and ViewMorph are the subject and the observer in Observer pattern.VIModelAbstract will notify the ViewMorph by calling ViewMorph>>update: aShape where aShape is the parameter containing the changes in the monitored object(s).
The concrete subjects, VIModel and SnapshotManager, correspond to a single monitored object or manages a set of monitored objects, respectively. The concrete observers, VIView and SnapshotView, display the animation of the behavior of monitored object(s).

Another application of the Observer pattern is in Shape (subject) and ShapeMorph (object) abstract classes. Shape will call update: on ShapeMorph directly whenever its internal data changes, thus the bundle of jobs in ViewMorph is reduced. The concrete shapes, ObjectShape and MessageShape, represent a monitored data object and a message sending, respectively. ObjectShapeMorph and MessageShapeMorph are concrete observers that display the shapes in the view.

Strategy

The model may use different strategies to monitor the message passing among monitored objects. Thus, VIModelAbstract is the Context in Strategy pattern, and abstract class WrappingStrategy is the Strategy. VIModelAbstract is configured with a ConcreteStrategy (the wrapper), which wraps the monitored objects and perform message tracing. VIModel uses AspectInstanceStrategy (instance wrapping) and SnapshotManager uses AspectClassStrategy (class wrapping). At the beginning, we used an different strategy, SourceCodeModification,
for message tracing by direct source code modification. This class still remains in our project code base as an alternative strategy. For a discussion of various possible wrapping strategies, see [BFJR99].

Adapter

We use the implementation of the wrapping methodologies [BFJR99] in Squeak 3.6 [AspectS, Hirs01]. This implementation can be easily ported to Squeak 3.7. To make that implementation fit our wrapping infrastructure, the Adapter pattern is utilized, where AspectStrategy (and its subclasses AspectClassStrategy and AspectInstanceStrategy) is the Adapter, AsAspect class from [AspectS] is the Adaptee. The Target interface is the WrappingStrategy used by VIModelAbstract class.

Template Method

We use the Template Method pattern in initialize method of abstract class ViewMorph. This method will call, step by step, setup methods that will be defined in concrete classes inheriting from ViewMorph. These methods include: setupConfigurationParameters, setupWin, setupMainColumn, setupMainRow, and setupLayout.

Last modified: May 14, 2005

References


[AspectS] AspectS homepage. http://www.prakinf.tu-ilmenau.de/~hirsch/Projects/Squeak/AspectS/.
[BFJR99] Brant J., Foote B., Johnson R., Roberts D. Wrappers to the Rescue. In: ECOOP’98 Proceedings, 1998
[GoF] Gamma E., Helm R., Johnson R., Vlissides J. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995.
[Hirs01] Hirschfeld R. AspectS – AOP with Squeak. In: OOPSLA 2001 Proceedings, 2001.


Links to this Page

  • Class projects last edited on 2 April 2008 at 5:20:59 pm by vpn3-144241.near.uiuc.edu
  • Michael Green last edited on 15 April 2005 at 12:53:16 pm by devtst01.cso.uiuc.edu
  • Henry Saputra last edited on 14 March 2005 at 7:58:03 pm by ouroboros.siebel.com
  • Ralph Johnson's schedule last edited on 12 May 2005 at 7:59:17 pm by 12-221-81-68.client.insightBB.com