Week 10 1 Sequence Diagrams. Outline a)Add scenarios to the system to describe how Use Cases are...
-
Upload
oswin-owen -
Category
Documents
-
view
215 -
download
1
Transcript of Week 10 1 Sequence Diagrams. Outline a)Add scenarios to the system to describe how Use Cases are...
Week 10
1
Sequence Diagrams
Outline
a) Add scenarios to the system to describe how Use Cases are realized as interactions among societies of objects
b) Describe a scenario by applying sequence diagramsc) Draw Sequence diagrams for given case studies
2
3
Sequence Diagram • Sequence diagram represents the dynamic
interaction between objects, or between actors and objects ordered in time.
• A sequence diagram is composed of a timeline, objects that interact across this timeline, and the messages that they exchange.
• Represent a scenario in the system
Major Ingredients of a Sequence Diagram
4
: Patient
aPatient :Patient
1: enquiresAvailability
Patient ChecksAvailability of Doctor
The Actor
Object
Time Line
Message
Self Message
Focus of Control
Steps in the Sequence
NotesT his is an
explanatory note
How do you start?
1. Identify the process/algorithm/activity you want to capture( may be a use case)
2. Identify the major objects involved 3. Map out the flow of control/ messages to
achieve the result
Relating Sequence Diagrams to Class Diagrams
6
aPatient: Patient
1: checkPatientDetails( )
Patient
checkPatientDetails( )
Objects on Sequence Diagrams belong to Classes in Class Diagram
Messages on Sequence Diagrams come from Methods available to the Class on Class Diagrams
A Layered Architecture
• Subsystems are shown as UML packages linked by dependencies
• A dependency without a stereotype means uses
7
Advancing the Sequence Diagrams from Analysis to Design: Showing specific objects
: ActorPatientaDoctor :
Doctor
checkAvailability( )
: ActorPatientSystem
checkAvailability()
(A)Analysis Sequence DiagramRead “System”
(B)Design Sequence DiagramShows “Doctor” – a Specific object
8
Representing objects
Message between objects
More on messages
Indicating method calls
Lifetime of objects
Understanding Focus of Control and return message
aPatient : Patient
: Doctor
getSchedule( )
getAvailable( )
availability
Focus ofControl
ReturnProtocol
14
Creating and Destroying an Object
: PatientForm
aPatient : Patient
bookConsultation( )
“Creating an Object”Shown with the arrow pointing directly to the Object
“Deleting an Object”Shown with a Cross on the Timeline
15
Manage course information• The sequence of steps carried out in the "Manage course information" flow
are:• A user who is a course administrator invokes the manage course
functionality. • The manage course functionality of the course administrator invokes either
the course creation or course modification functionality of a course. • After the course is either created or modified, the manage topic
functionality of the course administrator calls the topic creation or modification functionality of a topic.
• Finally, the user invokes the assign tutor to course functionality of the course administrator to assign a tutor to the selected course.
• Now, let us model these steps into a Sequence diagram for the "Manage course information" functionality.
• the following use cases for the Courseware Management System were defined:– View courses – Manage topics for a course – Manage course information – View course calendar – View tutors – Manage tutor information – Assign courses to tutors
• Sketch a sequence diagram for the “normal” operation of an ATM (i.e. a customer inserts the card, enters his/her PIN, enters the amount, takes the card, and takes the money). The sequence diagram should show the interaction between the different components of the ATM. The ATM consists of the following components:
• • screen • keyboard • card reader • money tray • money output device • interface to banking server (for modifications of the account data of the
customer)•
24
Use Case: Have Dinner
Scope: Restaurant
Primary Actor: Customer
Normal Flow: 1. Customer is seated at a table2. Customer asks the waiter for the menu.3. Customer orders drink(s).4. Customer orders appetizer(s).5. Customer orders main course(s).6. Customer orders dessert(s).7. Customer asks for the bill.8. Customer pays the bill and receives change (if any).
Alternate Flow / Exceptions:
1.aCustomer asks the waiter for his or her name.
Restaurant Example
25
26
27
A sequence diagram fragment that contain an alternative combination fragment
28A sequence diagram with a loop combination fragment
29
Make AppointmentUse Case-Analysis
Normal Flow: 1. Appointment clerk verifies that the needed medical service is provided by the hospital.
2. Appointment clerk records patient’s personal and contact data.
3. Appointment clerk records information about the referral source.
4. Appointment clerk consults hospital’s schedule to find a free slot for the required medical service.
5. Appointment clerk verifies that the patient is available for the appointment.
Loop 1: Repeat steps 4-5 until hospital’s schedule matches patient’s availability.
6. Appointment clerk makes the appointment. Loop 2: Repeat steps 4-6 for each appointment.
Alternate Flow/ Exceptions:
2.a Patient is not on file. Create new patient. (Extend: 141 - Create Patient.)
30
31
UML Extension Mechanisms • UML offers a set of mechanisms that
allow modeling to be refined, extended and adapted to specific needs.
• Stereotyping is the specialization of standard UML notations.
32
UML Stereotyping
• UML stereotyping is typically simple but powerful: If any building block of UML is not specialized enough to express your specific needs, you may specialize it yourself by specifying a tag and/or assigning an icon.
33
34
35
36
END