|
Sequence Diagram
UML sequence diagrams are used to represent or model the
flow of messages, events and actions between the objects or
components of a system. Time is represented in the vertical
direction showing the sequence of interactions of the header
elements, which are displayed horizontally at the top of the
diagram.
Sequence Diagrams are used primarily to design, document
and validate the architecture, interfaces and logic of the
system by describing the sequence of actions that need to be
performed to complete a task or scenario. UML sequence
diagrams are useful design tools because they provide a
dynamic view of the system behavior which can be difficult to
extract from static diagrams or specifications.
Targets
Objects as well as classes can be targets on a sequence
diagram, which means that messages can be sent to them. A
target is displayed as a rectangle with some text in it. Below
the target, its lifeline extends for as long as the target
exists. The lifeline is displayed as a vertical dashed line.
The basic notation for an object is
Where 'name' is the name of the object in the
context of the diagram and 'Type' indicates the type of which
the object is an instance. Note that the object doesn't have
to be a direct instance of Type, a type of which it is an
indirect instance is possible too. So 'Type' can be an
abstract type as well .
Messages
When a target sends a message to another
target, it is shown as an arrow between their lifelines. The
arrow originates at the sender and ends at the receiver. Near
the arrow, the name and parameters of the message are
shown.
A synchronous message is used when the sender
waits until the receiver has finished processing the message,
only then does the caller continue.
With an asynchronous message, the sender does
not wait for the receiver to finish processing the message, it
continues immediately. Messages sent to a receiver in another
process or calls that start a new thread are examples of
asynchronous messages. An open arrowhead is used to indicate
that a message is sent asynchrously
Conditional interaction
A message can include a guard, which signifies
that the message is only sent if a certain condition is met.
The guard is simply that condition between brackets.
|