OOMD Module2 Dynamic Modelling
OOMD Module2 Dynamic Modelling
Vidhya P.M
Dynamic Modeling
Vidhya P.M
concepts
Events represent external stimuli
States values of objects
State diagram
Vidhya P.M
Events
In real world,
concurrently.
all
Vidhya P.M
objects
exist
Vidhya P.M
Vidhya P.M
Vidhya P.M
Vidhya P.M
10
11
callee
two
concurrent
events
ringing stops
phones are connected
disconnected
Caller hangs up
Vidhya P.M
phone rings
answer phone
ringing stops
phones connected
Callee hangs up
disconnected
12
States
Vidhya P.M
13
Vidhya P.M
14
State diagram
It relates events and states.
When an event is received, the next
state depends on the current state as
well as the event; a change of state
caused by an event is called a transition.
State diagram is a graph whose nodes
are states and whose directed arcs are
transitions labeled by event names.
Vidhya P.M
15
On-hook
idle
Off-hook
Dial tone
Timed- out
Digit(n)
dialing
Busy tone
Fast busy tone
Num busy
Trunk busy
valid
Recorded message
Invalid no
connecting
routed
ringing
Called phone answers
connected
Called phone hangs up
disconnected
17
Vidhya P.M
18
nal state
(bull's eye)
initial state
(solid circle)
Start
White's
turn
black
moves
Black's
turn
checkmate
Black wins
stale
mate
white
moves
mate
stale
Draw
White wins
checkmate
One-shot
state diagram
One shot
The dynamic model is a collection of state diagrams that interact with each other
via shared events. An object model represents the static structure of a system, while
dynamic model represents the control structure of a system.
A scenario is to a dynamic model as an instance diagram is to an object model.
Conditions
A condition is a Boolean function of
object values.
When Ram goes out in morning( event),
if the temperature is below freezing(
condition), then he puts on his gloves
(next state).
Notation is [condition]
Vidhya P.M
20
Example
[number.isValid()]
Starting
entry / start dial tone
exit / end dial tone
dialed (n)
Dialing
entry / number.append(n)
dialed (n)
21
Operations
Vidhya P.M
22
Menu visible
Vidhya P.M
23
State1
do:activity1
Event1 (attributes)[condition1]/action1
Vidhya P.M
State2
do:activity1
24
Synchronization
Emitting
Do: Dispense
Cash
Setting
Up
Cash taken
Ready
to r eset
Ready
Do: Eject
Card
Card taken
Modeling Concurrency
Two types of concurrency
1. System concurrency
State of overall system as the aggregation of state diagrams,
one for each object. Each state diagram is executing
concurrently with the others.
2. Object concurrency
Sate generalization
A nested state diagram is a form of
generalization on states.
Generalization is or-relation.
States may have sub states that inherit
the transitions of their super states just
as classes have subclasses that inherit
the attributes and operations of their
super classes.
Vidhya P.M
28
Push R
Neutral
Reverse
Push N
Push N
Push F
Forward
Stop
upshift
First
upshift
Second
downshift
Third
downshift
Vidhya P.M
29
State Generalization
Generalization is the or-relationship. The states in the nested diagram are all
Transmission
Neutral
inherited
by each
gear
push F
push N
default
substate
Forward
superstate
abstract state
upshift
stop
First
upshift
Second
downshift
Reverse
Third
downshift
substate
An aggregation
and its
concurrent state
diagrams
Car
Ignition
Transmission
Brake
Accelerator
Ignition
Off
Starting
release key
On
push R
push N
Transmission
Neutral
Reverse
push F
push N
Forward
stop
upshift
First
upshift
Second
downshift
Third
downshift
Accelerator
Brake
depress accelerator
Off
depress brake
On
release accelerator
Off
On
release brake
Accelerator
Brake
press
press
Off
Release
On
Off
Vidhya P.M
Release
On
33
Functional Modeling
Vidhya P.M
34
Vidhya P.M
35
DFD
Vidhya P.M
36
Elements of DFD
Processes -> Transform data
ProcessName
Data flow -> move data
Actor ->objects that produce and consume
data. actorName
Data store -> objects that store data
passively.
Information/operation
that modify stored data
Data_storeName
37
Data Stores
38
Max temp
Readings
Min temp
Vidhya P.M
39
withdraw
Double headed arrow indicates that balance is both an i/p and o/p of
Subtract operation.
Vidhya P.M
40
Vidhya P.M
41
Bank
accounts
Account
select
balance
name
request
Customer
42
Create account
account
Bank
Name, deposit
Customer
account
Account
Vidhya P.M
43
Nested DFD
The nesting of a diagram is also called
leveling.
A process can be expanded into another
DFD.
Vidhya P.M
44
Control Flows
Vidhya P.M
45
Vidhya P.M
46
Coded password
Account
verify
password
customer
Password
OK
amount
balance
update
cash
Vidhya P.M
47
Specifying Operations
Vidhya P.M
48
Vidhya P.M
49
Vidhya P.M
50
Query
Vidhya P.M
51
Activity
It is an operation to or by an object that
has duration in time.
It has inherently side effects because of
its extension in time.
Activity only make sense for actors.
Vidhya P.M
52
constraints
53
FM Vs OM & DM
FM shows what has to be done by a
system.
The object model shows the doers- the
object.
DM shows the sequences in which the
operations are performed.
The three models come together in the
implementation of methods.
FM is a guide to the methods.
Vidhya P.M
54
Vidhya P.M
55
Vidhya P.M
56
Vidhya P.M
57
Vidhya P.M
58