Download - Sequence Diagram PBL
-
8/8/2019 Sequence Diagram PBL
1/18
1
ObjectInteraction
Sequence DiagramsWeek 7
-
8/8/2019 Sequence Diagram PBL
2/18
2
Objectives:
To model objectcollaboration using an interaction
sequence diagrams
Identifyand transform the usecasespecification
into sequence diagrams using UML notation.
-
8/8/2019 Sequence Diagram PBL
3/18
3
Interaction Diagram Interaction diagram is used to describe the
object interaction.
It is used to determine the most appropriatescheme of messaging between objects in order
to support a particular user requirements.
2 types of interaction diagram:
- sequence diagram
- collaboration diagram
-
8/8/2019 Sequence Diagram PBL
4/18
4
Sequence Diagrams Thesequence diagram showstheinteractions
among objectsthatparticipatein a usecaseand
the messagethatpassbetween them overtimefor one usecase.
Itisa dynamic modelthatshown in atimesequence.
Typically used to representthe detailedinteraction among object oftheclasses, notamong theclassesthemselves.
-
8/8/2019 Sequence Diagram PBL
5/18
5
Sequence Diagrams. Each usecasehasa number offlows
(basicflow,exceptionalflowsand
alternativeflows)
Eachsequence diagram represents ofthe
flowsthrough usecase diagram.
-
8/8/2019 Sequence Diagram PBL
6/18
6
Elements ofSequence Diagrams Actor
- Aperson/system thatparticipatesin a
sequencebysending or receiving
message.
- placeacrossthetop ofthe diagram using
actorsymbol (refer use-case diagram)
Actor
-
8/8/2019 Sequence Diagram PBL
7/18
7
- Placeacrossthetop ofthe diagram
using objectsymbol. Participatesin asequencebysending or receivingmessage.
Elements ofSequence Diagrams
Object
Object
-
8/8/2019 Sequence Diagram PBL
8/18
8
- Objectscommunicatebysending
messages- Messageisan information sentto objects
to execute one ofitsbehaviour.
- using solid linesconnecting two objects.
Elements ofSequence Diagrams
Message
CustomerPanel DrinkMgrSelect drink
-
8/8/2019 Sequence Diagram PBL
9/18
9
Elements ofSequence Diagrams
lifeline
- using dotted line runsverticallybeloweachactorand objectto denotethelifeline oftheactor/objectovertime.
I
I
II
I
-
8/8/2019 Sequence Diagram PBL
10/18
10
Elements ofSequence Diagrams
Focus of control
- isalong, narrow rectangleplaced atopa
lifeline.- indicatestimes during an activation when
processing istaking placewithin the object.
-
8/8/2019 Sequence Diagram PBL
11/18
11
Reflexive message
- objectcan send messageto itself
Elements ofSequence Diagrams
Object
m e s s age
-
8/8/2019 Sequence Diagram PBL
12/18
12
Example ofSequence diagram
The process begins when Joe inserts his card into thecard reader. The card reader reads the number on Joescard, then tells the ATM screen to initialize itself. TheATM prompts Joe forhis PIN. Joe enters his PIN andthe ATM opens his account. Joes PIN is validated, andthe ATM prompts him for a transaction. Joe selects
Withdraw. The ATM prompts Joe for the withdrawalamount. Joe enters $20. The ATM verifies that Joesaccount has sufficient funds, and subtracts $20 fromthe account. The ATM dispenses $20 and ejects Joescard.
Scenario : Joe, a bank customer withdrawing $20from the ATM
-
8/8/2019 Sequence Diagram PBL
13/18
13
Example ofSequence diagram
Focusof control
Reflexivemessage
object
Lifeline
Complete Sequence diagram
Joe AccountJoe :
ustomer ard Reader ATM creen
ash dispenser ATM Manager
insert cardread card no.
prompt PIN
enter PIN
send card no.
initialize screen
send PIN retrieve PIN
validate PIN
-
8/8/2019 Sequence Diagram PBL
14/18
14
Stepsforbuilding Sequence
Diagram Setthecontext ofsequence diagram
- definewhich usecase/ ascenario ofa use
case (normalflow,alternativeflowandexceptionalflow)
Identifywhichactorwillinvolve
Identifywhich objectswillparticipate
Setthelifelineforeach object Layoutthe messagefrom thetopto the
bottom ofthe diagram based on the orderinwhichtheyarearesent.
-
8/8/2019 Sequence Diagram PBL
15/18
15
Stepsforbuilding Sequence
Diagram.
Add thefocus ofcontrolto each objects
life Validatethesequence diagram
-
8/8/2019 Sequence Diagram PBL
16/18
16
ExerciseIts time
to do the
exercise
-
8/8/2019 Sequence Diagram PBL
17/18
17
Based on the usecasespecification given,drawasequence diagram forbasicflow of
Buy Drink
Use Case Specification
-
8/8/2019 Sequence Diagram PBL
18/18