A sequence
diagram is an easily comprehensible visualization of single scenarios or
examples of business processes with regard to their behavior in time. It
focuses on when the individual objects interact
with each other during execution. The diagram essentially includes a
timeline that flows from the top to the bottom of the diagram and is
displayed as a dotted line. The interaction between objects is described
by specifying the different kinds of messages sent between them.
Messages are called stimuli. They are displayed as arrows; the diverse
arrowheads stand for different kinds of messages (see below).
The following diagram shows a typical example:
Objects
After creating or changing objects, they are automatically arranged in the Diagram pane. You can specify which of the objects is to have control by enabling the corresponding check box 'Focus of control' in the Properties tab. Afterwards, you'll see how the graphical representation of this object changes: it gets a thick border and its lifeline is no longer a dashed line but a solid rectangular area.
Self messages
In Poseidon, all stimulus types, except create stimuli, can be created as self stimuli. In the case of a stimulus to itself, the arrow starts and finishes on the object's lifeline. A self stimulus is created by dropping the stimulus target point on the source object.
Selecting an operation
A call stimulus is regarded as a procedure call and can be connected with any operation provided by the receiving object, depending on its type. This is achieved by connecting the stimulus with an action that will cause the class operation to be called. The following two figures show an example for selecting an operation and attaching actual arguments to the call.
After selecting the stimulus in the diagram, the Details pane shows the properties of the stimulus. It is there that you have to open the dispatched action field displayed in the Details pane, which is directly below the name field of the stimulus. This causes the Details pane to change the view to the properties of the action.
The properties of the action allow you to select an operation and edit the arguments attached to the procedure call. The set of possible operations includes all operations of the receiving object's class, as well as any operations inherited from direct and indirect superclasses or interfaces. If an operation is selected, the name of the action is updated according to the name of the operation and the given values of the arguments. An empty argument value is displayed as an 'x'. Keep in mind that you cannot edit the name field while an operation is selected.
Activations
An activation shows the period of time during which an object will perform an action, either directly or through a subordinate procedure. It is represented as a tall thin rectangle with the top aligned with its point of initiation and the bottom aligned with its point of completion.
Now, let's consider how Poseidon deals with starting and terminating activations. When an object receives a stimulus, an activation is created that starts at the tip of the incoming arrow. When an object sends a stimulus, an existing activation is terminated at the tail of the outgoing arrow. There are two exceptions: First, an outgoing send stimulus does not terminate an existing activation, because it represents an asynchronous message. Second, if an object has explicitly set the focus of control, its activation will continue during the whole lifetime.
Notes on Sequence Diagrams
focus on the order in which messages are sent (procedural flow)
'lifeline' is the dashed line from each object - denotes length of life
The white narrow rectangles that the arrows terminate on are called activations. They show the duration of the execution of a method in response to a message. The methods implicitly return to their caller at the end of the activation. Such returns can be shown by an unlabeled arrow that extends from the bottom of the activation back to the lifeline of the calling object. In the case of asynchronous messages (described later), the end of an activation does not imply a return.
Objects - Elements responsible for sending
and receiving messages.
Call stimuli - Represents a
synchronous message, which means that it is regarded as a
procedure call.
Send stimuli - Illustrates an
asynchronous message, which means that it is regarded as a signal.
As such, the sender doesn't wait for an answer from the
receiver.
Return stimuli - Represents the
return statement of a call stimulus.
Create stimuli - Used to create a
new object at a certain point in the sequence. The created object
will then be placed at this specific point and not at the top of
the Diagram pane.
Destroy stimuli - Used to destroy
an object at a specific point in the sequence. The lifeline of the
destroyed object will then end with a cross at this point and not
at the bottom of the Diagram pane.