UML Behavioral Diagram - people.utm.my SE/sequence... · Sequence Diagram. INSPIRING CREATIVE AND...
Transcript of UML Behavioral Diagram - people.utm.my SE/sequence... · Sequence Diagram. INSPIRING CREATIVE AND...
INSPIRING CREATIVE AND INNOVATIVE MINDS
• 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
Execution
Specification
Lifeline
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()
Return message
Invoke 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 inthe university community--student, professor, and staffmember. Users of the directory can look up entries. In addition,the administrator of the telephone book can, after supplying apassword, insert new entries, delete existing entries, modifyexisting entries, print the telephone book, and print a listing ofall 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 nounphrases from the specification:
computerized telephone book, university, telephone book,entry, person, university community, student, professor, staffmember, employee, user, administrator, password.
2. Identify the candidate operations. List the verbs from thespecification.
lookup entry, supply password, insert new entry, delete existingentry, modify existing entry, print telephone book, print allstudents, print all employees, set telephone number field, gettelephone number field, compare entries.
INSPIRING CREATIVE AND INNOVATIVE MINDS
Use Case Analysis -How to find class
3. Eliminate unnecessary and synonym classes andoperations.
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 entryoperations 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.