sequence diagrams

advertisement
SEQUENCE DIAGRAMS
The sequence diagram is a dynamic view that shows the symbols of UML
objects/classifiers, and messages passed along. It is a graphical description of the operations
of a system based on chronology and it represents the life of UML objects over a definite
period of time. It displays an interaction as a two-dimensional chart. The vertical dimension is
the time axis, and the horizontal dimension shows the UML objects roles that represent
individual objects in the collaboration.
A sequence diagram represents behavior in terms of interactions. It complements the class
diagram that represents the static structure of the system. It specifies the behavior of classes,
interfaces, and the possible use of their operations. It also describes the scenario of a specific
use case – its functionality.
If an actor is the invoker of the interaction shown on the sequence diagram, it is usually
represented by the first (farthest left) lifeline in the sequence diagram. If you have several
actors in the diagram, you should try to position them to the farthest left or to the farthest right
lifelines because actors are, by definition, external to the system.
An object lifeline is the dashed vertical line under the UML object symbol. Time always
proceeds down the page. The object lifeline indicates the period during which a UML object
exists. If the UML object is created or destroyed during the period of time shown on the
diagram, then its lifeline starts or stops at the corresponding point.
A message is a communication between objects that conveys information with the
expectation to invoke an operation. The receipt of a message should normally have an
outcome. A message has a sender, a receiver, and an action. The sender is the UML object
that sends the message. The receiver is the UML object that receives the message. The action
is executed to transmit the information. A message is shown as a horizontal solid arrow from
the lifeline of one object to the lifeline of another. The arrow is labeled with the name of the
message.
When you create a message, you can choose to create an execution specification at the
same time. Drawing an execution specification can be particularly useful if you want to
describe a procedural flow. The execution specification represents the period of time during
which a UML object is performing an action and is shown as a thin rectangle.
A self message is a message sent from a UML object to itself, the sender and the receiver
is the same UML object.
Systems Analysis
Karolina Muszyńska
An example sequence diagram for “Verify Account Balance” use case
ICashMachine
CardOperatorSystem
:ClientAccount
Client
1: insertPIN
2: verifyPIN
3: confirmClientAuthorization
4: verifyAccountBalance
5: checkClientAccountBalance
6: displayAccountBalance
An example sequence diagram for “Make hotel reservation” use case
IReservation
:AvailableRooms
:Reservation
Receptionist
1: openReservation
2: checkAvailableRooms
3: displayAvailableRooms
4: insertReservationData
5: makeReservation
6: confirmation
7: closeReservation
8: displayMenu
Systems Analysis
Karolina Muszyńska
An example sequence diagram for “Place New Order” use case
Access Control
Order Submission System
Order
Client
Warehouse System Accounting System
login
placeOrder
verifyProductAvailability
insertCreditCardData
verifyData
chargeAccount
saveOrder
Systems Analysis
Karolina Muszyńska
Download