contents  
previous
B. Interaction diagrams
Interaction diagrams
help to show how objects interact with each
other during particular scenerios (or use cases). There are two
types of such diagrams: sequence diagrams
and
collaboration diagrams.
1. Sequence diagrams
Sequence diagrams put the accent on viewing the temporal flow of object
interactions, by lining objects up horizontally and then regarding the
vertical direction as a "time line". Here are some points worth noting,
some, but not all of which, are seen in the next example:
- A thin box along the dashed vertical line for an object represents an
activation
of the object. In the absence of concurrent propgramming,
an activation starts when the object is given control by means of a method
call and ends with the return from this call.
- When one object activates another, an arrow is drawn from the "lifeline"
(vertical line) of the first object to that of the second object.
- Solid arrow heads are used for sequential activations, i.e. for
method calls. In a concurrent programming situation, other types of arrow heads
are used,
as for example, when one object activates another, but the first object does
not need to wait on the second object to do something.
- It's nice to arrange the objects so that the arrows point left to right
as much as possible.
- Arrows can be labeled using method call notation or plain english to
indicate the nature of the activation.
- If a method call has a return value that needs to be saved and used by
the caller, then use notation like value := method(...).
- A dashed arrow can be used to represent a return from a method call (but
these tend to clutter up the diagram when over used).
- An asterisk attached to an arrow represents that the arrow might be used
repeatedly (see example).
- Guards
(enclosed in brackets) of the sort seen earlier in activity diagrams,
can also be used here (and in collaboration diagrams). Multiple arrows can leave
from the same point as long as they are labeled with guards that are mutually
exclusive. In this case, the arrow used during a particular scenerio depends on
which guard is true. (See Figure 2-30 on page 51 of Bruegge-Dutoit.)
- A "X" marks the end of an object's life.
Let's look at one possible sequence
diagram for one possible selection process scenerio in the jukebox
example.
next