Sequence Diagrams - problems and methods Problem areas Version 020920 Decomposition and References

advertisement
Sequence Diagrams - problems and methods
Version 020920
INF -UIT 2002 / Sequence Diagrams - method / Slide 1
Øystein Haugen
Ketil Stølen
Problem areas
l Decomposition and References
– how can we precisely define the combination of decomposition and
references?
– what about decomposition and combined interactions?
l Data
– where is data in interactions?
– what data can be involved in guards?
INF -UIT 2002 / Sequence Diagrams - method / Slide 2
Øystein Haugen
Ketil Stølen
Simple Decomposition Revisited
sd Authorization
:ServiceBase
ref SB_Authorization
:ServiceUser
:ServiceTerminal
Code
sd SB_Authorization
OK
OnWeb
:Central
OK
Code
create
:Authorizer
OK
OK
OnWeb
sequence of
actual gates
sequence of
formal gates
Øystein Haugen
INF -UIT 2002 / Sequence Diagrams - method / Slide 3
Ketil Stølen
Decomposing when covering references and
combined fragments
sd GoHomeSetup
:ServiceUser
ref
sd SB_GoHomeSetup
:ServiceBase
ref SB_GoHomeSetup
:ServiceTerminal
:Central
ref
Authorization
:TimeKeeper
SB_Authorization
opt
opt
ref
FindLocation
SetHome
SetHome
SetInvocationTime
SetInvocationTime
SetTransportPreferences
SetTransportPreferences
Combined
fragment
reference
INF -UIT 2002 / Sequence Diagrams - method / Slide 4
sequence of
actual
constructs
sequence of
corresponding
constructs
Øystein Haugen
extra-global
combination
Ketil Stølen
global
ref
Commutative Decomposition
sd GoHomeSetup
sd SB_GoHomeSetup
:ServiceBase
ref SB_GoHomeSetup
:ServiceUser
ref
:ServiceTerminal
:Central
Authorization
ref
opt
:TimeKeeper
SB_Authorization
opt
ref
FindLocation
SetHome
SetHome
SetInvocationTime
SetInvocationTime
SetTransportPreferences
SetTransportPreferences
sd SB_Authorization
sd Authorization
:Central
:ServiceBase
ref SB_Authorization
:ServiceUser
:ServiceTerminal
Code
Code
create
:Authorizer
OK
OnWeb
OK
OK
OK
Øystein Haugen
INF -UIT 2002 / Sequence Diagrams - method / Slide 5
Data in Guards
OnWeb
Ketil Stølen
static
parameter
time intv;
time last;
coord lastpos ;
coord dist;
coord pos;
sd GoHomeInvocation(Time invoc)
guard on global or
static values
:ServiceUser
:Clock
:ServiceBase
[Now>invoc]
InvocationTime
:ServiceTerminal
FindLocation
TransportSchedule
guard on dynamic
and local values,
local to the object of
the first event of
operand
loop
alt
[Now>interv+last]
ScheduleIntervalElapsed
FindLocation
TransportSchedule
note that there is no
single object deciding
the choice, but each
guard is limited
[pos-lastpos>dist]
GetTransportSchedule
TransportSchedule
FetchSchedule
INF -UIT 2002 / Sequence Diagrams - method / Slide 6
Øystein Haugen
Ketil Stølen
Evaluating Property Languages
transparency
The World
expressiveness
Property Language
verifiability
Formal base
Øystein Haugen
INF -UIT 2002 / Sequence Diagrams - method / Slide 7
Ketil Stølen
Comparison between Property Languages
Property
Prose
Seq. diag.
Focus
State Machines
liveness, safety
fair
fair
good
fair
overview
good
good
fair
good
interaction
poor
good
fair
fair
time req.
fair
poor
good
poor
capacity
fair
poor
fair
poor
transparency
good
good
poor
good
expressiveness
fair
fair
good
good
formalization
poor
good
good
good
INF -UIT 2002 / Sequence Diagrams - method / Slide 8
Øystein Haugen
Ketil Stølen
Basic Sequence Diagram Methodology
Even though Sequence Diagrams are simple and may be read and
produced by engineers without much formal training, it is possible to:
•• make
makebeautiful
beautifuldiagrams
diagramsthat
thatsay
saynothing,
nothing,
•• make
messy
diagrams
that
are
meant
make messy diagrams that are meantto
toconvey
conveycritical
criticalinformation,
information,
•• make
terrible
diagrams
in
an
early
phase
that
make
it
impossible
make terrible diagrams in an early phase that make it impossibletoto
design
designaasensible
sensiblesystem
systemininaalater
laterphase.
phase.
•• use
extensions
to
UML/MSC
that
are
use extensions to UML/MSC that arenot
notstandard
standardand
andthat
thatmay
mayprevent
prevent
you
youfrom
fromusing
using(more
(morethan
thanone)
one)tools.
tools.
The methodology aims at bridging the gap between the notation and the
development process using it.
INF -UIT 2002 / Sequence Diagrams - method / Slide 9
Øystein Haugen
Ketil Stølen
Seq. diag. classification: case evaluation
•• Normal
Normalbehavior
behaviorisisthe
thebehavior
behaviorthat
thatwe
weexpect
expect
•• Exceptional
cases
are
those
that
may
happen,
Exceptional cases are those that may happen,and
andthat
thatwe
weshould
should
prepare
preparefor,
for,but
butwhich
whichwe
wedo
donot
notconsider
considernormal.
normal.
•• The
Theerroneous
erroneous behavior
behaviorisisbehavior
behaviorthat
thatwe
wetry
tryto
toavoid,
avoid,but
butwhich
whichshould
should
not
notdestroy
destroyour
oursystem.
system.
•• Impossible
Impossiblebehavior
behaviorisisbehavior
behaviorthat
thatcannot
cannothappen
happen
Impossible behavior
Possible behavior
Normal behavior
Exceptional behavior
Critical behavior
Erroneous behavior
INF -UIT 2002 / Sequence Diagrams - method / Slide 10
Øystein Haugen
Ketil Stølen
Seq. diag. classification: descriptive goal
Descriptive
Descriptivegoal
goal
historical
historical
Life
Lifespan
span
temporary
temporary
documentary
documentary
Target
Targetaudience
audience
project
members,
project members,managers,
managers,
potential
potentialcustomers
customers
managers,
managers,customers
customers
requirements
requirements
customers,
customers,project
projectteam
team
product
productspan
span
design
design
test
test
project
projectteam
team
testers,
customers
testers, customers
project
project
product
productspan
span
INF -UIT 2002 / Sequence Diagrams - method / Slide 11
Øystein Haugen
negotiations
negotiationsor
or
product
productspan
span
Ketil Stølen
Step 0: Make explicit the company SD strategy
•• Tools:
Tools:What
Whattools
toolswill
willbe
beused
usedto
toproduce
produceand
andmaintain
maintainthe
themscs?
mscs?
•• Coverage
Profile:
How
do
the
diagrams
cover
the
universe
of
Coverage Profile: How do the diagrams cover the universe of
scenarios?
scenarios?
•• Document
DocumentProfile:
Profile:What
Whatdiagrams
diagramsare
areto
tobe
beproduced?
produced?
•• The
TheInexpressible:
Inexpressible:How
Howisisinformation
informationnot
notexpressible
expressibleininUML/MSC
UML/MSC
attached?
attached?
INF -UIT 2002 / Sequence Diagrams - method / Slide 12
Øystein Haugen
Ketil Stølen
Step 1a: the first sequence diagrams
•• Our
Ourmetaphore
metaphorefor
forbuilding
buildingour
ourMSC
MSCdocument
documentisisaa news
newsphotographer
photographer
covering
coveringaamajor
majorevent.
event.
•• Firstly
Firstlyhe
hewill
willmake
makesure
sureto
totake
takepictures
picturesof
ofthe
themain
maincharacters
characters––the
the
normal
cases.
normal cases.
•• Then
Thenhe
hewill
willlook
lookfor
forsome
someexceptional
exceptionalsituation
situationwhich
whichmight
mightsell
sellbetter
betterto
to
the
thepublic
publicand
andwhich
whichmay
maycapture
captureunexpected
unexpectedproblems
problemslike
likethe
thepolice
police
horse
horsegalloping.
galloping.
•• Then
he
Then hedigs
digsfor
for errors
errorslike
likethe
thepossible
possibleassassin
assassinininthe
thebushes.
bushes.
•• Finally
Finallyhe
hecould
couldillustrate
illustratethe
the impossible
impossible by
bymanipulating
manipulatingaapicture
picturelike
like
placing
placingForrest
ForrestGump
Gumpwith
withPresident
PresidentNixon.
Nixon.
INF -UIT 2002 / Sequence Diagrams - method / Slide 13
Øystein Haugen
Ketil Stølen
Step 1b: Establish the interplay with non-developers
•• Require
Requireresponsibility
responsibilityand
andapproval
approvalfrom
fromthe
thenon-developers;
non-developers;
•• Involve
the
non-developers
in
making
additional
Involve the non-developers in making additionaldiagrams
diagramsmaking
making
sure
that
they
understand
UML/MSC
and
that
they
sure that they understand UML/MSC and that theyunderstand
understand
that
thatthey
theyunderstand
understandUML/MSC;
UML/MSC;
•• Associate
concrete
input/output
Associate concrete input/outputwith
withthe
theuser
userinterface.
interface.
•• Encourage
Encouragethe
thenon-developers
non-developersto
touse
usetheir
theirUML/MSC
UML/MSCknowledge
knowledge
during
the
design
and
model
checking
phases
during the design and model checking phases
INF -UIT 2002 / Sequence Diagrams - method / Slide 14
Øystein Haugen
Ketil Stølen
Summary Basic Sequence Diagram (MSC-92) strategy
Step 0 : company strategy
what tools
what coverage
what MSC documents
How to attach informal text
Step 1a : the first mscs
Step 1b : interplay with non-developers
require responsibility
active involvement
be concrete
encourage further use of MSC
normal
exceptional
erroneous
impossible
critical
Step 2a : Variants and similarity
global conditions
road map
MSC document table
Step 2b : Refinement
message hierarchy
instance hierarchy
Step 2c : Inexpressibles
dependency
capacity and duration
Step 3 : Support the design
alignment table
checking existence
checking full coverage
Step 4 : Test mscs
isolate IUT
project existing mscs
INF -UIT 2002 / Sequence Diagrams - method / Slide 15
Øystein Haugen
Ketil Stølen
The Advanced Sequence Diagram Distillery
l Distillation =
– the process of purifying a liquid
lby successive
– evaporation and
– condensation
l Sequence Diagram Distillation =
– the process of purifying an SD description
lby successfully making it
– more detailed
– more precise
INF -UIT 2002 / Sequence Diagrams - method / Slide 16
Øystein Haugen
Ketil Stølen
How to make wine from water
abstraction
level
precision
distill
details
prove refinement
details
precision
time
INF -UIT 2002 / Sequence Diagrams - method / Slide 17
Øystein Haugen
Ketil Stølen
Making more precise
l formalize
– move the description to a more formal language
l narrow
– add more properties to make it less underspecified
l supplement
– add new aspects
INF -UIT 2002 / Sequence Diagrams - method / Slide 18
Øystein Haugen
Ketil Stølen
Make more detailed
l decompose
– divide the instances / actors /objects
l break down
– divide the means of communication
l reveal
– find new items not “visible” when objects were bigger
INF -UIT 2002 / Sequence Diagrams - method / Slide 19
Øystein Haugen
Ketil Stølen
Service: Dolly Goes To Town
l Informal specification:
– ”Dolly gets transport schedules when she wants to return home from
town. The schedules take her from where she is to her home”
INF -UIT 2002 / Sequence Diagrams - method / Slide 20
Øystein Haugen
Ketil Stølen
Make more precise – formalize
l ”Dolly gets transport schedules when she wants to return home
from town. The schedules take her from where she is to her home”
sd GoHome
:ServiceUser
ref
:ServiceBase
:ServiceTerminal
GoHomeSetup
loop
ref
ref
INF -UIT 2002 / Sequence Diagrams - method / Slide 21
GoHomeInvocation
GoHomeDismantle
Øystein Haugen
Ketil Stølen
Make more precise – narrow
l ”Dolly gets transport schedules when she wants to return home
from town. The schedules take her from where she is to her home”
– Dolly subscribes to a schedule service from her web-browser
– Dolly gets the schedules on her mobile terminal
– Dolly gets the schedules via SMS
l Is the formalization consistent with the narrowing?
– Perhaps! The two descriptions are not obviously in harmony, but rather
focus on different aspects
INF -UIT 2002 / Sequence Diagrams - method / Slide 22
Øystein Haugen
Ketil Stølen
Make more precise – supplement
l ”Dolly gets transport schedules when
she wants to return home from town.
The schedules take her from where
she is to her home”
sd GoHomeSetup
:ServiceUser
:ServiceBase
Code
– what happens if she is not
authorized during setup?
ref
OK
– what if her home location is not
set, or it is wrong?
:ServiceTerminal
Authorization
OK
opt
ref
FindLocation
SetHome
SetInvocationTime
SetTransportPreferences
INF -UIT 2002 / Sequence Diagrams - method / Slide 23
Øystein Haugen
Ketil Stølen
Make more detailed – decompose
l decomposing the ServiceBase
sd GoHomeSetup
:ServiceUser
ref
sd SB_GoHomeSetup
:ServiceBase
ref SB_GoHomeSetup
:ServiceTerminal
:Central
ref
Authorization
SB_Authorization
opt
opt
ref
FindLocation
SetHome
SetHome
SetInvocationTime
SetInvocationTime
SetTransportPreferences
SetTransportPreferences
INF -UIT 2002 / Sequence Diagrams - method / Slide 24
Øystein Haugen
:TimeKeeper
Ketil Stølen
Make more detailed – break down
l ”the service needs the location of the mobile terminal”
sd FindLocation
:ServiceBase
:ServiceTerminal
Location
:Clock
:ServiceBase
:ServiceTerminal
InvocationTime
FindLocation
TransportSchedule
INF -UIT 2002 / Sequence Diagrams - method / Slide 25
Øystein Haugen
Ketil Stølen
Make more detailed – reveal
l ”Dolly gets transport schedules when she wants to return home
from town. The schedules take her from where she is to her home”
– The presentation is not significant on the domain level, but becomes
visible on the design level
lhow shall the schedule be presented?
lshould the different schedules be sorted in a particular way?
lhow should the information retrieved be destroyed?
INF -UIT 2002 / Sequence Diagrams - method / Slide 26
Øystein Haugen
Ketil Stølen
Distilling
l During the process from informal understanding to more precise
and more detailed description
– the number of diagrams have grown
– changes have been made in some diagrams that should have implied
changes in other diagrams
l(not saying that anything is actually wrong, but not absolutely
uniform)
– new understanding has been reached that has not really had impact on
all corners of the design
l Distilling means
– to purify the description
lto show uniform approaches to problems
lthat similar situations appear similar (and vice versa)
lthat good overview is achieved and the new understanding properly
conveyed to others
INF -UIT 2002 / Sequence Diagrams - method / Slide 27
Øystein Haugen
Ketil Stølen
Download