15.7. Basic Sequence Diagram Notation

Links

Unlike collaboration diagrams, sequence diagrams do not show links.

Messages

Each message between objects is represented with a message expression on an arrowed line between the objects (see Figure 15.17). The time ordering is organized from top to bottom.

Figure 15.17. Messages and focus of control with activation boxes.


Focus of Control and Activation Boxes

As illustrated in Figure 15.17, sequence diagrams may also show the focus of control (that is, in a regular blocking call, the operation is on the call stack) using an activation box. The box is optional, but commonly used by UML practitioners.

Illustrating Returns

A sequence diagram may optionally show the return from a message as a dashed open-arrowed line at the end of an activation box (see Figure 15.18). Many practitioners exclude them. Some annotate the return line to describe what is being returned (if anything) from the message.

Figure 15.18. Showing returns.


Messages to “self” or “this”

A message can be illustrated as being sent from an object to itself by using a nested activation box (see Figure 15.19).

Figure 15.19. Messages to “this.”


Creation of Instances

Object creation notation is shown in Figure 15.20.

Figure 15.20. Instance creation and object lifelines.


Object Lifelines and Object Destruction

Figure 15.20 also illustrates object lifelines—the vertical dashed lines underneath the objects. These indicate the extent of the life of the object in the diagram. In some circumstances it is desirable to show explicit destruction of an object (as in C++, which does not have garbage collection); the UML lifeline notation provides a way to express this destruction (see Figure 15.21).

Figure 15.21. Object destruction.


Conditional Messages

A condition message is shown in Figure 15.22.

Figure 15.22. A conditional message.


Mutually Exclusive Conditional Messages

The notation for this case is a kind of angled message line emerging from a common point, as illustrated in Figure 15.23.

Figure 15.23. Mutually exclusive conditional messages.


Iteration for a Single Message

Iteration notation for one message is shown in Figure 15.24.

Figure 15.24. Iteration for one message.


Iteration of a Series of Messages

Notation to indicate iteration around a series of messages is shown in Figure 15.25.

Figure 15.25. Iteration for a sequence of messages.


Iteration Over a Collection (Multiobject)

In sequence diagrams, iteration over a collection is shown in Figure 15.26.

Figure 15.26. Iteration over a multiobject.


With collaboration diagrams the UML specifies a '*' multiplicity marker at the end of the role (next to the multiobject) to indicate sending a message to each element rather than repeatedly to the collection itself. However, the UML does not specify how to indicate this with sequence diagrams.

Messages to Class Objects

As in a collaboration diagram, class or static method calls are shown by not underlining the name of the classifier, which signifies a class object rather than an instance (see Figure 15.27).

Figure 15.27. Invoking class or static methods.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.167.248