Information Technology Reference
In-Depth Information
aChain
HotelChain
aHotel
Hotel
object
window
UserInterface
makeReservation():v
o
id
makeReservation():v
o
id
iteration
message
[for each day] isRoom := available():boolean
condition
aReservation
Reservation
[isRoom]
aNotice
activation bar
creation
note
If a room is available for
each day of the stay, make
a reservation and spend a
lifeline
Fig. 3.13
Sequence diagram (Miller
2003
)
In the figure above, the sequence is initiated by the
UserInterface
instance
of the
window
class, which sends a message to the
HotelChain
object via the
makeReservation
method. At this point,
HotelChain
then sends a
makeReservation
message to
Hotel
. Here we can see an iteration through
which
Hotel
moves in order to test whether or not a room is available for each
day requested. If this condition is met,
Hotel
creates the
Reservation
object,
which in turns creates a
Confirmation
notice to complete the sequence. In this
image, each box represents an object and each straight arrow depicts a message
call. The vertical dotted lines represent lifelines, which define how long an object
exists before destruction. The activation bars shown denote the time for the exe-
cuting of the message. The topmost message call made by the
Hotel
object is a
call back to itself, and is an iteration, which is denoted by the asterisk. Expressions
shown in square brackets are conditions that are tested. The note contained in the
rectangle is simply for clarification, and can be used in any UML diagram.
3.4.4 State Diagrams
An object's state describes that object based on all of its properties and their values
at a given instant in time. An object's behavior is a response to its state, and thus
changes based on its current state. Similarly, a state diagram describes a software
system based on its behavior, and thus in relation to the states of the objects that