Object Interaction Diagrams

An object interaction diagram shows a sequence of method invocations among a set of objects. The important elements of the diagram are the objects that are involved and the sequencing of the invocations. The compact, direct way in which the sequence of invocations is presented in the diagram is in stark contrast to the obscure way in which the same relationship exist in the source code. In the source code the sequence of interactions is dispersed, each class's code containing one part of the sequence. The invocations are also interspersed with the other code in each class. The object interaction diagram, however, extracts the essential information and presents it in a single, integrated and succint form.

An example of an object interaction diagram is shown below. This diagram involves three objects (aCanvas, aShape, and aLocation). Time flows from the top of the diagram to the bottom of the diagram. Invocations are drawn as horizontal arrows labelled by the name of the method being invoked. An object is ddrawn as a thin vertical line during periods when it is not processing an invocation. An object is drawn as a rectangle during periods when it is processing an invocation.



The diagram shows the scenario (the sequence of invocations) that occurs when a Canvas object is asked to perform its "Scroll" method. In this diagram, the aCanvas object receives the Scroll method invocation to initiate the sequence. The aCanvas object uses the MoveTo method to reposition the aShape object at its new viewing position. In this example the aShape object is assumed to be an object in the Rectangle class. To reposition itself, aShape calls its own Erase (from its current location) and Draw (at its new location) methods. In between erasing and drawing, aShape changes its location by using the Change method in the aLocation object. Finally, to perform the erasing and drawing, the aShape object "calls back" to the aCanvas object, using the EraseLine and DrawLine methods of the Canvas class.

Last Updated: December 6, 1995 / kafura@cs.vt.edu