Unit 5 (C)
Unit 5 (C)
A Sequence diagram shows the participants (Objects) in an interaction and the sequence of
message among them.
A sequence diagram shows the interaction of a system with its actors to perform all or part of a
use case.
Sequence diagram represent the dynamic communication between object during execution of
task.
Each use case requires one or more sequence diagram to describe its behavior.
Each sequence diagram shows a particular behavior sequence of the use case.
It is best to show a specific portion of a use case and not attempt to be too general.
You can draw a separate sequence diagram for each task.
1
Components of Sequence Diagram
Object - Class Roles or Participants Object : Class
2
Components of Sequence Diagram Cont.
Messages
Messages are arrows that represent communication between objects.
Use the following arrows and message symbols to show how information is transmitted
between objects.
Synchronous message
Represented by a solid line with a solid arrowhead.
This symbol is used when a sender must wait for a response to a message before it continues.
The diagram should show both the call and the reply.
Asynchronous message
Represented by a solid line with a lined arrowhead.
Asynchronous messages don't require a response before the sender continues.
Only the call should be included in the diagram.
3
Components of Sequence Diagram Cont.
Reply message
Represented by a dashed line with a lined arrowhead.
these messages are replies to calls.
Delete message X
4
Guideline for Sequence Diagram
Prepare at least one scenario per use case Abstract the scenarios into sequence diagrams.
The steps in the scenario should be The sequence diagrams clearly show the
logical commands, not individual button contribution of each actor.
clicks.
It is important to separate the contribution of
You can specify the exact syntax of input. each actor as a prelude to organizing
Start with the simplest mainline behavior about objects.
interaction - no repetitions, one main
activity, and typical values for all Divide complex interactions
parameters. Break large interactions into their constituent
If there are substantially different tasks and prepare a sequence diagram for
mainline interactions, write a scenario for each of them.
each.
Prepare a sequence diagram for each error condition.
Show the system response to the error condition.
5
Steps to Draw a Sequence Diagram
Step-1 Select one scenario
Step-2 Identify the necessary set of the objects. Who is taking part ?
Step-3 Identify the necessary interactions/steps.
Step-4 Describe the message exchange between object.
Step-5 Identify the sequence of interactions and who starts Interactions.
6
Example: Sequence Diagram for Book Issue
Book issue is a one business process or a function in Library Management System.
Necessary objects for book issue process are Librarian, Book, Member and Transaction .
Member class object starts the interaction.
Various interactions in book issue process are
1 Request for a book
2 Check availability of book
3 Validate the member
4 Check No. of books issued by member
5 Add book issue details to transaction
6 Update no of book issued by member
7 Update book status
7
Sequence Diagram for Book Issue