News  |  About  |  Tools  |  Training Courses |  Services |  Contact Us

 
 


 
 

The Refactory News
About Us
Tools
Refactoring Browser
Method Wrappers
Sharp Smalltalk
SmaCC
Training
Services
 
Tools  

  Method Wrappers - Interaction Diagram

The interaction diagramming tool will automatically create interaction diagrams from your running VisualWorks program. You can select which classes you want to view, execute your code, and then have the tool automatically build an interaction diagram of your code.

The interaction diagramming tool was originally a project done by David Wheeler, Jeff Will, and Jinghu Xu for Prof. Johnson's CS497 class. I rewrote the display code so that it could handle thousands of events (using interval trees), and refactored some of the recording to be more robust.

To install the interaction-diagramming tool, you need to parcel-in the InteractionDiagram.pcl file.

To run the tool, choose the "Interaction Diagram" option from the "Tools" menu on the launcher. This will open a window similar to the picture above. After opening the window, the first thing you'll need to do is to select some methods to watch. For example, you might want to select all methods in the "Browser*" categories. Once you have selected the methods you want, you need to "Install" the wrappers. Now you need to execute some to generate some events. If you installed the wrappers on the Browser* categories, then you might want to open a RefactoringBrowser (i.e., "RefactoringBrowser open"). After you have generated some events, you'll need to uninstall the wrappers. When you uninstall the wrappers, the diagram will update with the events you generated.

Reading the results: the diagrams generated by the tool are similar to the interaction diagrams seen in many books, but there is one notable exception. Since we only select a few methods to observe, we miss some messages. As a result, there are times when a message is received, but the last method entered did not send the message. For example, suppose you have:

	Foo>>createBar
		^Bar new

	Bar>>initialize
		"do some initialization"

	Bar class>>new
		^super new initialize

and that you only wrap Foo>>createBar and Bar>>initialize. If you send a Foo the createBar message, that event will be recorded. It will send the new message to Bar class, but since that method is not wrapped, it is not observed. When the new method sends the initialize method to a Bar, it is observed, but the last observed method did not send it. Such events are called indirect message sends and are displayed as yellow lines. In the picture above, we can see that "a RefactoringBrowser" sent a closed message to some object that wasn't wrapped, which resulted in the update:with:from: method being called on "(nothing selected)" (a CodeModel).

There are several features that could be added to the interaction diagramming tool. If you want a feature, you can send me email, but the quickest way to have the feature implemented might be to do it yourself. Since I have several other projects, I cannot dedicate too much time to improving the diagramming tool. I can provide email support for you to implement the feature. Once you have completed the feature, you should submit it so that everyone can use it.