Lab # 4 Modeling Sequence Diagram: Objective

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Introduction To Software Engineering (SWE-104) SSUET/QR/114

Lab # 4
Modeling Sequence Diagram
Objective
 Creating a Sequence Diagram
 Getting familiar with sequence diagram symbols and notations
 Steps for creating a Sequence Diagram

Getting familiar with sequence diagram symbols and notations:

A sequence diagram in a Unified Modeling Language (UML) is a kind of interaction diagram


that shows how processes operate with one another and in what order. What messages are sent
and when. Sequence diagrams are sometimes called event diagrams, event scenarios, and timing
diagrams. 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.

Sequence Diagrams captures:

 the interaction that takes place in a collaboration that either realizes a use case or an
operation (instance diagrams or generic diagrams)
 high-level interactions between user of the system and the system, between the system
and other systems, or between subsystems (sometimes known as system sequence
diagrams)

Purpose of Sequence Diagram:

 Model high-level interaction between active objects in a system


 Model the interaction between object instances within a collaboration that realizes a use
case
 Model the interaction between objects within a collaboration that realizes an operation
 Either model generic interactions (showing all possible paths through the interaction) or
specific instances of a interaction (showing just one path through the interaction) .

Sequence Diagram - Model before Code:


Sequence diagrams can be somewhat close to the code level, so why not just code up that
algorithm rather than drawing it as a sequence diagram?
 A good sequence diagram is still a bit above the level of the real code
 Sequence diagrams are language neutral
 Non-coders can do sequence diagrams

Lab#04: Sequence Diagram 20


Introduction To Software Engineering (SWE-104) SSUET/QR/114

 Easier to do sequence diagrams as a team

Below is a sequence diagram for making a hotel reservation. The object initiating the sequence
of messages is a Reservation window.

Basic Sequence Diagram Symbols and Notations


Class roles
Class roles describe the way an object will behave in context. Use the UML object symbol
to illustrate class roles, but don't list object attributes.

Lab#04: Sequence Diagram 21


Introduction To Software Engineering (SWE-104) SSUET/QR/114

Activation
Activation boxes represent the time an object needs to complete a task.

Messages
Messages are arrows that represent communication between objects. Use half-arrowed lines to
represent asynchronous messages. Asynchronous messages are sent from an object that will not
wait for a response from the receiver before continuing its tasks.

Lifelines
Lab#04: Sequence Diagram 22
Introduction To Software Engineering (SWE-104) SSUET/QR/114

Lifelines are vertical dashed lines that indicate the object's presence over time.

Loops
A repetition or loop within a sequence diagram is depicted as a rectangle. Place the condition for
exiting the loop at the bottom left corner in square brackets [].

Destroying Objects
Objects can be terminated early using an arrow labeled "<< destroy >>" that points to an X.

Lab#04: Sequence Diagram 23


Introduction To Software Engineering (SWE-104) SSUET/QR/114

Exercise:

Q1: Model a Sequence Diagram for login operation.


 The new customer will enter his/her user id& password and then click on login button on
the login.aspx Webpage.
 The Session Manager gets the user id and user details from Customer class instance and
verifies the user id and password.
 If user details are invalid customer will not be allowed to login and an appropriate error
message will be displayed, otherwise the customer is logged in.

Sequence Diagram

Lab#04: Sequence Diagram 24

You might also like