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, and therefore
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 selecting the desired stimulus on the toolbar and then double-clicking on the object's lifeline at the position you want the stimulus to be placed.
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.
Changing activations
It is possible to change the generated activations to suit your own preferences. First, you have to select the stimulus (or the underlying link) and open the context menu by right-clicking with the mouse. The items available in the context menu depend on the activation state of the sending object. If the outgoing stimulus intersects an existing activation of the sending object, then the activation can be broken up. If the outgoing stimulus terminates an activation, then the activation can be continued. The following two figures show how to do this:
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.