Sequence Diagram

UML
Behavioral Diagram
Sequence Diagram
• Sequence diagrams show object interactions
arranged in a time sequence
• Sequence diagrams demonstrate the
behavior of objects in a use case by describing
the objects and the messages they pass.
• The diagrams are read left to right and
descending
INSPIRING CREATIVE AND INNOVATIVE MINDS
Sequence Diagram Elements
Lifeline
Execution
Specification
Message
INSPIRING CREATIVE AND INNOVATIVE MINDS
Lifeline & Execution Specification
A lifeline represents an individual participant (or object)
in the interaction
A lifeline is shown using a symbol that consists of a
rectangle forming its “head” followed by a vertical line
(which may be dashed) that represents the lifetime of the
participant
An execution specification specifies a behavior or
interaction within the lifeline
An execution specification is represented as a thin
rectangle on the lifeline.
INSPIRING CREATIVE AND INNOVATIVE MINDS
Messages
Define a particular communication
between lifelines of an interaction
Examples of communication
raising a signal
invoking an operation
creating or destroying an instance
INSPIRING CREATIVE AND INNOVATIVE MINDS
Message Types
sd Interaction
Weather Operator
Weather Station
Weather
Controller
Weather Data
Instrument
retrieve()
getData()
collect()
get()
sendData()
ok()
ok()
displayData()
Invoke message
Return message
INSPIRING CREATIVE AND INNOVATIVE MINDS
Use Case Analysis-How to find class
i) Method to find objects and their classes:
Begin with the nouns in the requirements specification.
ii) Method to find operations:
Begin with the verbs in the requirements specification.
Example: Computerized Telephone Book For A University
The telephone book should contain entries for each person in
the university community--student, professor, and staff
member. Users of the directory can look up entries. In addition,
the administrator of the telephone book can, after supplying a
password, insert new entries, delete existing entries, modify
existing entries, print the telephone book, and print a listing of
all students or of all faculty.
INSPIRING CREATIVE AND INNOVATIVE MINDS
Use Case Analysis -How to find class
1.
Identify the candidate classes. List the nouns and noun
phrases from the specification:
computerized telephone book, university, telephone book,
entry, person, university community, student, professor, staff
member, employee, user, administrator, password.
2. Identify the candidate operations. List the verbs from the
specification.
lookup entry, supply password, insert new entry, delete existing
entry, modify existing entry, print telephone book, print all
students, print all employees, set telephone number field, get
telephone number field, compare entries.
INSPIRING CREATIVE AND INNOVATIVE MINDS
Use Case Analysis -How to find class
3.
Eliminate unnecessary and synonym classes and
operations.
For example, computerized telephone book, telephone book,
and directory can be combined into a single PhoneBook class.
4. Associate the operations with the appropriate classes.
For example, associate lookup, insert, delete, and modify entry
operations with the PhoneBook class, associate compare,
setPhoneNumber and getPhoneNumber with the Person class,
etc.
During design we should not be concerned with the
minute details of the implementation. However, it is
appropriate to consider whether there is a "reasonable"
implementation.
INSPIRING CREATIVE AND INNOVATIVE MINDS
Use Case Analysis -How to find class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Boundary class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Example – Boundary class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Entity class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Example – Entity class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Control class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Example – Control class
INSPIRING CREATIVE AND INNOVATIVE MINDS
Boundary
Control
Entity
INSPIRING CREATIVE AND INNOVATIVE MINDS
Boundary
Sequence Diagram – Need Improvements?
INSPIRING CREATIVE AND INNOVATIVE MINDS
Diagram 2
20
Diagram 3
21
Diagram 4
22