Sunteți pe pagina 1din 6

Module Outline

• Major Ingredients of Sequence Diagram


• Importance and Relevance of Sequence
Diagram in Analysis
• Interaction Overview Diagrams
Sequence and Interaction Overview • State Machine Diagrams in Dynamic
Diagrams; State Machine Modelling
Diagrams

"Copyright Practical OO Analysis, 1 "Copyright Practical OO Analysis, 2


Thomson Publishing, 2005". Thomson Publishing, 2005".

Major Ingredients of a Sequence Diagram


1: enquiresAvailability
Sequence diagram…
: Patient

• Dynamic interactions between collaborating


objects in the system
aPatient :Patient

• Represent a scenario in the system


• Show a set of collaborating objects, messages
passing between them, and timing
Patient Checks
Availability of Doctor

T hi s is a n
exp la n a to ry n o te

"Copyright Practical OO Analysis, 3 "Copyright Practical OO Analysis, 4


Thomson Publishing, 2005". Thomson Publishing, 2005".

A Basic Sequence Diagram


Sub-module
aDoc tor :
System : A c torP ati ent
: ActorPatient Doc tor

Sequence diagrams for hospital


checkAvailability() c hec k A vailability ( ) management system

Sequence Diagrams show the instance level


Sequence of Interactions between Objects,
System and, occasionally, Actors
"Copyright Practical OO Analysis, 5 "Copyright Practical OO Analysis, 6
Thomson Publishing, 2005". Thomson Publishing, 2005".

1
“Registering a Patient “ Sequence Diagram “Updating a Calendar“ Sequence Diagram
aInterface aCalendar :
: Staff
Calendar
System GHRS
: ActorPatient : Administrator ShowCalendar()
GetCalendar()
This is a hypothetical
AnnounceArrival() object meant to represent
actor system interaction.
Real objects will replace
ProvideDetails() the system object shown EnterRosterDetails()
here in detailed diagrams
VerifyCalendar()
Ent erDetails()
Separate Sequence Separate Sequence
VerifyDetails()
Diagrams will apply
ValidateRosterDetails() diagrams need to be
if Insufficient Details
are provided by
created if there are
VerifyMedi calInsuranceDetails() Patients conflicting Rosters

UpdateCalendar()
CreatePatientRecord()

CreatePatientRecordID()
AcceptedRosterDetails()

"Copyright Practical OO Analysis, 7 "Copyright Practical OO Analysis, 8


Thomson Publishing, 2005". Thomson Publishing, 2005".

“Booking a Consultation “ Sequence “Paying a Bill “ Sequence Diagram


Diagram
: BPay : Bill
: ActorPatient
aInt erface :Physician : Calendar
: ActorPatient

SpecifyInitialConsultationDetails()
displayPayment( )

ProvidePhysicianList()
Veirfy BpayStat ement()

Calendar is
Select Physician() separately
updated by acceptPayment( )
Get AvailableDate&Tim e() Doctor (Staff) in
terms of their
UpdateBill( )
availability

SelectDate&Time()
GenerateReceipt()
UpdateCalendar()

ConfirmReceipt()
Confirm Date&Time()

"Copyright Practical OO Analysis, 9 "Copyright Practical OO Analysis, 10


Thomson Publishing, 2005". Thomson Publishing, 2005".

Relating Sequence SWOT of a Sequence Diagram


Objects on Sequence
Diagrams belong to Classes Diagrams to Class STRENGTHS: OBJECTIVES:
in Class Diagram Show the interaction between Actor and
Diagrams Show the dynamic behavior
of the system system
typically as an ‘example’ within a use case
Show a set of collaborating
objects, messages passing Show the message passing between
between them, and timing collaborating objects, or system and actor
aPatient:
Ideal “snap shot” representation Messages with their signatures provide direct
Patient
Patient of ‘what happens’ information to programmers
Mechanism to help users build storyboards
1: checkPatientDetails( ) checkPatientDetails( ) Mechanism to discover Classes and Methods
WEAKNESSES:
Snapshots, hence incomplete TRAPS:
Presents behavior, but still not Attempting to show a ‘complete’ sequence is
considered truly Dynamic by many a major trap – do not try to complete a
Messages on Sequence Diagrams seq.diagram
come from Methods available to Inappropriate level of usage (BA trying
the Class on Class Diagrams technical, and vice versa)

"Copyright Practical OO Analysis, 11 "Copyright Practical OO Analysis, 12


Thomson Publishing, 2005". Thomson Publishing, 2005".

2
Ingredients of an Interaction Overview
Diagram

Sub Module #

ref
EnquirySequence

Interaction diagrams ! " $ % &

"Copyright Practical OO Analysis, 13 "Copyright Practical OO Analysis, 14


Thomson Publishing, 2005". Thomson Publishing, 2005".

“Consultation Details “ Interaction


Overview Diagram
Sub-module ref
ChecksCalendar

NO
"BookingAvailable?"

Interaction overview diagrams for Check the Calendar re f


YES

BooksConsultation

hospital management system


again for Alternatives.
If no bookings available,
no consultation takes place
ref
ExaminesPatient

ref r e f
Interaction Overview OrdersTests WritesPrescriptions

Diagrams reference Sequence


diagrams or Use cases,
providing an overview of flow
"Copyright Practical OO Analysis, 15 between them. "Copyright Practical OO Analysis, 16
Thomson Publishing, 2005". Thomson Publishing, 2005".

“ Accounting“ Interaction Overview


Diagram
ref
PaysBill Sub-Module
Method

State chart diagrams


CashCheque
CARD BPAY
ref r e f r e f
PaysBillByCard PaysBillOnInternetBPAY CashChequePayment

State, Transitions
Private?
YES

r e f
PlacesInsuranceClaim
NO

"Copyright Practical OO Analysis, 17 "Copyright Practical OO Analysis, 18


Thomson Publishing, 2005". Thomson Publishing, 2005".

3
Ingredients of a State Machine
Diagram States, Transitions
• States Describe the Values of Attributes of an
Object
• An object in a State:
' ! – Performs some action.
( +
– Waits for an event.
• Transition makes
[ CorrectDetails ]
) * * %
an object change its State
/ acceptPolicy

"Copyright Practical OO Analysis, 19 "Copyright Practical OO Analysis, 20


Thomson Publishing, 2005". Thomson Publishing, 2005".

Initial and Final States How to Build a State Chart?


• Start State • Determine the Sequences and Events that involve
– The state of the object at the start of its lifetime. this Object
– A statechart must have exactly one start state. • For each event, determine the effect it has on the
state of the object.
• Stop State • Apply transitions to the states of an Object
– The state of the object at the end of its lifetime. • Add guard conditions associated with the event.
– Optional – a statechart will not have a stop state if the • Determine Nested and Historical States
object is never destroyed.
• Only for Complex, Dynamic and/or Important
– A statechart can have many stop states.
Objects
"Copyright Practical OO Analysis, 21 "Copyright Practical OO Analysis, 22
Thomson Publishing, 2005". Thomson Publishing, 2005".

“Patient “ State Machine Diagram

Sub-module Registered

Surgi cal

State machine diagrams for


Yes No

For OutPatient,
Admitted Consulting follow

hospital management system Consulation


StateChart

Operated

Recovered

Released

"Copyright Practical OO Analysis, 23 "Copyright Practical OO Analysis, 24


Thomson Publishing, 2005". Thomson Publishing, 2005".

4
“Consultation“ State Machine “Bill Payment“ State Machine
Diagram Diagram
Open

Available
Generated PartPaid
[ Cancelled ]

Booked
SuperStates for
Consultation Objects
Issued [ PastDueDate ] Overdue

Closed

Provided
Paid?
Yes No

Billed
Paid Defaulted

"Copyright Practical OO Analysis, 25 "Copyright Practical OO Analysis, 26


Thomson Publishing, 2005". Thomson Publishing, 2005".

SWOT of a State machine


Diagram
STRENGTHS: OBJECTIVES:
Represents the ‘lifecycle’ of an Display the changes to the state
object or a business entity of an object, and events that
Demonstrates the dynamic aspect create those changes
of the system Extensively used in Modeling of
real-time system Exercises
WEAKNESSES:
Deals with only one
object’s lifecycle
TRAPS: For Classroom
Confusing with Activity diagrams
Remains Incomplete as does Too many technical details in
not show all objects and all business-level diagrams
states and transitions in one
diagram

"Copyright Practical OO Analysis, 27 "Copyright Practical OO Analysis, 28


Thomson Publishing, 2005". Thomson Publishing, 2005".

Workbook Exercises Workbook Exercises


1. Draw a sequence diagram to show instance-level 4. Observe if you are able to identify any new
behaviour from one of your earlier use cases in classes as a result of drawing the sequence
chapter 4 (check the documentation of that use
diagrams.
case to draw the sequence diagram)
2. Draw a sequence diagram to show dynamic 5. Identify a Use case diagram in Chapter 5. Draw
behaviour from an activity diagram documented an Interaction Overview Diagram corresponding
by you in Chapter 5 to that use case diagram.
3. Identify a few operations from the above exercise 6. Identify an object from the HMS. Create a rough
in drawing sequence diagrams; that were not state table for that object. Now draw a
described in the corresponding classes. Update corresponding State Machine Diagram for that
the classes with those operations. object.
"Copyright Practical OO Analysis, 29 "Copyright Practical OO Analysis, 30
Thomson Publishing, 2005". Thomson Publishing, 2005".

5
Conclusions
• Sequence diagrams in
Interaction between Collaborating Objects
Interaction between Actors and System.
• Naming an interaction overview diagram
• State machine diagrams show various states of
the object during its lifecycle.

"Copyright Practical OO Analysis, 31


Thomson Publishing, 2005".

S-ar putea să vă placă și