Class and object diagrams are static model views. Interaction
diagrams describe dynamic behavior by showing how objects
collaborate to accomplish a task.
A sequence diagram details how
operations are carried out - what messages are sent and when.
Sequence diagrams are organized according to time. The time
progresses as you go down the page. The objects involved in the
operation are listed from left to right according to when they
take part in the message sequence.
Below is a sequence diagram for making a hotel reservation. The
object initiating the sequence of messages is a Reservation
The Reservation window sends a makeReservation() message to a
HotelChain. The HotelChain then sends a makeReservation() message to
a Hotel. If the Hotel has available rooms, then it makes a
Reservation and a Confirmation.
Each vertical dotted line is a lifeline, representing the time that
an object exists. Each arrow is a message call. An arrow goes from
the sender to the top of the activation bar of the message on the
receiver's lifeline. The activation bar represents the duration of
execution of the message.
In our diagram, the Hotel issues a self call to determine if a room
is available. If so, then the Hotel creates a Reservation and a
Confirmation. The asterisk on the self call means iteration (to make
sure there is available room for each day of the stay in the hotel).
The expression in square brackets, [ ], is a condition.
The diagram has a clarifying note, which is text inside a dog-eared
rectangle. Notes can be put into any kind of UML diagram.
A message is asynchronous if it allows its sender to send additional
messages while the original is being processed. The timing of an
asynchronous message is independent of the timing of the intervening
The following sequence diagram illustrates the action of a nurse
requesting a diagnostic test at a medical lab. There are two
asynchronous messages from the Nurse: 1) ask the MedicalLab to
reserve a date for the test and 2) ask the InsuranceCompany to
approve the test. The order in which these messages are sent or
completed is irrelevant. If the InsuranceCompany approves the test,
then the Nurse will schedule the test on the date supplied by the
The object diagram below instantiates the class diagram, by
replacing it by a concrete example.
The UML uses the following message conventions.
Simple message which may be synchronous or asynchronous
Simple message return (optional)
A synchronous message
An asynchronous message
An asynchronous message return