week 10 1 sequence diagrams. outline a)add scenarios to the system to describe how use cases are...

36
Week 10 1 Sequence Diagrams

Upload: oswin-owen

Post on 19-Jan-2016

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 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

Week 10

1

Sequence Diagrams

Page 2: 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

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

Page 3: 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

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

Page 4: 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

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

Page 5: 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

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

Page 6: 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

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

Page 7: 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 Layered Architecture

• Subsystems are shown as UML packages linked by dependencies

• A dependency without a stereotype means uses

7

Page 8: 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

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

Page 9: 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

Representing objects

Page 10: 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

Message between objects

Page 11: 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

More on messages

Page 12: 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

Indicating method calls

Page 13: 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

Lifetime of objects

Page 14: 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

Understanding Focus of Control and return message

aPatient : Patient

: Doctor

getSchedule( )

getAvailable( )

availability

Focus ofControl

ReturnProtocol

14

Page 15: 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

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

Page 16: 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
Page 17: 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
Page 18: 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
Page 19: 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

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.

Page 20: 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

• 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

Page 21: 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
Page 22: 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

• 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)•

Page 23: 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
Page 24: 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

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

Page 25: 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

25

Page 26: 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

26

Page 27: 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

27

A sequence diagram fragment that contain an alternative combination fragment

Page 28: 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

28A sequence diagram with a loop combination fragment

Page 29: 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

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.)

Page 30: 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

30

Page 31: 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

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.

Page 32: 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

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.

Page 33: 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

33

Page 34: 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

34

Page 35: 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

35

Page 36: 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

36

END