Scenario as UML sequence diagrams 2Figure 13.2 – Sequence diagram for a loan scenario : LoanManager BookRequest PatrID, BookID : Staff self-interaction event attributes instance disa
Trang 1Building System Models for RE
Chapter 13 Modeling System Behaviours
Trang 2Building models for RE
Behaviors
Trang 3The behaviour model
Specific behaviours of specific agent instances All possible behaviours of any agent instance.
Trang 4Modeling system behaviours: outline
Trang 5Modeling instance behaviours
– Positive scenario: the sequence of interactions illustrates a possible Positive scenario: way of satisfying an behavioural goal.
– Negative scenario: the sequence of interactions illustrates a possible Negative scenario: way of satisfying an obstacle to a goal.
Interaction: Interaction
operation whose effect is monitored by the target agent
instance.
Trang 6Scenario as UML sequence diagrams
Sequence diagrams are a UML variant of the event trace diag.
Basic UML syntax for sequence diagrams is similar to the one used in event trace diagrams.
Figure 13.1 – Scenario represented by a sequence diagram
: Train Actuator/Sensor
: OnBoard Controller
doorsOpening
exit doorsClosing
event name
! trainStopped
startAcceler
Trang 7Scenario as UML sequence diagrams (2)
Figure 13.2 – Sequence diagram for a loan scenario
: LoanManager BookRequest (PatrID, BookID)
: Staff
self-interaction event attributes
instance disappears
: CopyManager
LoanQtyOK? (PatrID) CpyAvailable? (BookID)
Reserved? (BookID) OK-Available (CopyID)
OK-Book (PatrID, CopyID) checkOut (PatrID, CopyID)
Registered? (PatrID)
Figure 13.3 – Negative scenarios and optional interactions
opt
: Train Actuator/Sensor
: OnBoard
Controller
AlarmPressing AccelerComnd
doorsOpening
exit doorsClosing
:Passenger
optional interaction
: Passenger
: OnBoard Controller
! trainStopped
startAcceler AlarmPropagation
Trang 8Scenario refinement: Episodes and agent
decomposition
coarse-grained scenario first then refine it with further details
Trang 9Scenario refinement: Episodes
Figure 13.4 – Scenario refinement: introducing episodes
:Scheduler meetingRequest
(dateRange, withWhom)
: Initiator
reference to another diagram
: Participant
schedule DeterminationConstraintsAcquired
notification (date, location)
notification (date, location)
:Scheduler
? constraints (dateRange)
Trang 10Scenario refinement: agent decomposition
Figure 13.5 – Scenario refinement: agent decomposition
: LoanManager : Staff : CopyManager
CpyAvailable? (BookID)
Reserved? (BookID)
OK-Available (CopyID)checkOut (PatrID,CopyID)
BookRequest (PatrID, BookID)
OK-Book (PatrIDCopyID)
LoanQtyOK? (PatrID)Registered? (PatrID)
Trang 11Modeling system behaviours: outline
Trang 12Modeling class behaviours
provided by scenarios in multiple ways:
specific one.
state transitions, not just a specific one
Snapshot state <-> SM state
State transitions captured by a state machine refer to SM states.
The events causing state transitions can be of different types:
does not controls.
the State Machine
Trang 13State machines as UML state diagrams
A state machine is represented in UML by a variant of a statechart called a state diagram.
Some features …
Figure 13.6 – A simple SM diagram for a BookCopyInfo entity controlled by LibraryManager
checkOut (PatrID, self)
return (PatrID, self)
event with attribute
loss
SM state
initial state final state
transition
Trang 14State machines as UML state diagrams (2)
‘producing’ diagram to a ‘consuming’ diagram where this event causes transitions.
Trang 15State machines as UML state diagrams (3)
Figure 13.7 – A SM diagram for a BookInfo entity controlled by LibraryManager
Trang 16State machines as UML state diagrams (4)
Figure 13.9 – Send actions for diagram synchronization: BookCopyInfo revisited
Available onLoan
event notification
to consumer
loss
/ send BookInfo.copyReturn / send BookInfo.copyBorrowing
OK-request
/ Inform initiator
…
ConstraintsRequested entry / Inform initiator Planning
Trang 17State machine refinement: sequential and concurrent
sub-states
– Sub-state -> nested state / super-state -> composite state
of nested diagrams.
Trang 18State machine refinement: sequential decomposition
Semantic rules define sequential state decomposition more precisely: [textbook, p459)
Trang 19State machine refinement: parallel decomposition
Semantic rules define parallel state decomposition more precisely:
state name composite state
concurrent
substate
guard as synchronizing condition + sequential
decomposition
Trang 20Modeling system behaviours: outline
Trang 21Building behaviour models
strengths and limitations:
– Goals are declarative, capture functional, non-functional and alternative options aspects.
of expression.
– State machines provide visual abstractions of explicit
behaviours of any agent instance in a class.
partnership for building complex models.
scenarios and state machines (textbook.p464).
Trang 22Building behaviour models