You are on page 1of 24

Business Modelling

Sequence Diagrams

"Copyright Practical OO Analysis,


1
Thomson Publishing, 2005".
Module Outline
• Major Ingredients of Sequence Diagram
• Importance and Relevance of Sequence Diagram
in Analysis
• Interaction Overview Diagrams
• State Machine Diagrams in Dynamic Modelling

"Copyright Practical OO Analysis,


2
Thomson Publishing, 2005".
Major Ingredients of a Sequence Diagram
1: enquiresAvailability
Message
The Actor
: Patient

Self Message

aPatient :Patient
Object Focus of Control

Time Line

Patient Checks Steps in the


Availability of Doctor
Sequence

T h is is a n
explanatory note
Notes

"Copyright Practical OO Analysis,


3
Thomson Publishing, 2005".
Sequence diagram…
• Dynamic interactions between collaborating
objects in the system
• Represent a scenario in the system
• Show a set of collaborating objects, messages
passing between them, and timing

"Copyright Practical OO Analysis,


4
Thomson Publishing, 2005".
A Basic Sequence Diagram

aDoctor :
: ActorPatient
System Doctor
: ActorPatient

checkAvailability() checkAvailability( )

Sequence Diagrams show the instance level


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

Sequence diagrams for hospital


management system

"Copyright Practical OO Analysis,


6
Thomson Publishing, 2005".
“Registering a Patient “ Sequence Diagram

System GHRS
: ActorPatient : Administrator

This is a hypothetical
AnnounceArrival() object meant to represent
actor system interaction.
Real objects will replace
ProvideDetails() the system object shown
here in detailed diagrams

EnterDetails()
VerifyDetails() Separate Sequence
Diagrams will apply
if Insufficient Details
are provided by
VerifyMedicalInsuranceDetails() Patients

CreatePatientRecord()

CreatePatientRecordID()

"Copyright Practical OO Analysis,


7
Thomson Publishing, 2005".
“Updating a Calendar“ Sequence Diagram

aInterface aCalendar :
: Staff
Calendar
ShowCalendar()
GetCalendar()

EnterRosterDetails()
VerifyCalendar()

Separate Sequence
ValidateRosterDetails() diagrams need to be
created if there are
conflicting Rosters

UpdateCalendar()

AcceptedRosterDetails()

"Copyright Practical OO Analysis,


8
Thomson Publishing, 2005".
“Booking a Consultation “ Sequence Diagram

aInterface :Physician : Calendar


: ActorPatient

SpecifyInitialConsultationDetails()

ProvidePhysicianList()

Calendar is
SelectPhysician() separately
updated by
GetAvailableDate&Time() Doctor (Staff) in
terms of their
availability

SelectDate&Time()

UpdateCalendar()

ConfirmDate&Time()

"Copyright Practical OO Analysis,


9
Thomson Publishing, 2005".
“Paying a Bill “ Sequence Diagram

: BPay : Bill
: ActorPatient

displayPayment( )

VeirfyBpayStatement()

acceptPayment( )

UpdateBill( )

GenerateReceipt()

ConfirmReceipt()

"Copyright Practical OO Analysis,


10
Thomson Publishing, 2005".
Objects on Sequence Relating Sequence
Diagrams belong to Classes
in Class Diagram Diagrams to Class Diagrams

aPatient:
Patient
Patient

1: checkPatientDetails( ) checkPatientDetails( )

Messages on Sequence Diagrams


come from Methods available to
the Class on Class Diagrams

"Copyright Practical OO Analysis,


11
Thomson Publishing, 2005".
SWOT of a Sequence Diagram
STRENGTHS: OBJECTIVES:
Show the dynamic behavior Show the interaction between Actor and
of the system system
Show a set of collaborating typically as an ‘example’ within a use case
objects, messages passing Show the message passing between
between them, and timing collaborating objects, or system and actor
Ideal “snap shot” representation Messages with their signatures provide direct
of ‘what happens’ information to programmers
Mechanism to help users build storyboards
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 a major trap – do not try to complete a
many seq.diagram
Inappropriate level of usage (BA trying
technical, and vice versa)

"Copyright Practical OO Analysis,


12
Thomson Publishing, 2005".
Sub-Module

State Machine Diagrams

Part of Dynamic Modeling

"Copyright Practical OO Analysis,


13
Thomson Publishing, 2005".
Ingredients of a State Machine Diagram

State
Start State

Stop State Nesting

Transition
& Decision Point
Self-Transition

Notes
[ CorrectDetails ]
Guard Condition/
/ acceptPolicy
Action

"Copyright Practical OO Analysis,


14
Thomson Publishing, 2005".
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 an
object change its State

"Copyright Practical OO Analysis,


15
Thomson Publishing, 2005".
Initial and Final States
• Start State
– The state of the object at the start of its lifetime.
– A statechart must have exactly one start state.

• Stop State
– The state of the object at the end of its lifetime.
– Optional – a statechart will not have a stop state if the
object is never destroyed.
– A statechart can have many stop states.

"Copyright Practical OO Analysis,


16
Thomson Publishing, 2005".
How to Build a State Chart?
• Determine the Sequences and Events that involve
this Object
• For each event, determine the effect it has on the
state of the object.
• Apply transitions to the states of an Object
• Add guard conditions associated with the event.
• Determine Nested and Historical States
• Only for Complex, Dynamic and/or Important
Objects

"Copyright Practical OO Analysis,


17
Thomson Publishing, 2005".
Sub-module

State machine diagrams for hospital


management system

"Copyright Practical OO Analysis,


18
Thomson Publishing, 2005".
“Patient “ State Machine Diagram

Registered

Surgical

Yes No

For OutPatient,
Admitted Consulting follow
Consulation
StateChart

Operated

Recovered

Released

"Copyright Practical OO Analysis,


19
Thomson Publishing, 2005".
“Consultation“ State Machine Diagram
Open

Available

[ Cancelled ]

Booked
SuperStates for
Consultation Objects

Closed

Provided

Billed

"Copyright Practical OO Analysis,


20
Thomson Publishing, 2005".
“Bill Payment“ State Machine Diagram

Generated PartPaid

Issued [ PastDueDate ] Overdue

Paid?
Yes No

Paid Defaulted

"Copyright Practical OO Analysis,


21
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

WEAKNESSES:
Deals with only one TRAPS:
object’s lifecycle 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,


22
Thomson Publishing, 2005".
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,


23
Thomson Publishing, 2005".
Project Work :

Followthe Project Work Requirements given at


the End of the Chapter;
Discuss Project Work with Team Members and
Tutor;
Carry Out the Project Work
"Copyright Practical OO Analysis,
24
Thomson Publishing, 2005".

You might also like