oomd module2 dynamic modelling
Post on 13-Apr-2018
228 Views
Preview:
TRANSCRIPT
-
7/26/2019 OOMD Module2 Dynamic Modelling
1/58
1
Module 2: Dynamic modeling
Vidhya P.M
-
7/26/2019 OOMD Module2 Dynamic Modelling
2/58
2
Dynamic Modeling
First examine the system at a single moment of time.
Then examine changes to objects and theirrelationships over time.
Those aspects of a system that are concerned with
time and changes are dynamic model, in contrast withstatic or object model.
Control is the aspect of a system that describes thesequences of operations that occur in response to
external stimuli without considering what the operationdo, what they operate on, and how they areimplemented.
Vidhya P.M
-
7/26/2019 OOMD Module2 Dynamic Modelling
3/58
Vidhya P.M 3
concepts
Eventsrepresent external stimuli
Statesvalues of objects
State diagram
-
7/26/2019 OOMD Module2 Dynamic Modelling
4/58
Vidhya P.M 4
Events
It is something that happens at a point in time,withnoduration
Anindividualstimulusfromoneobjecttoanotherisanevent.
One event may logically precede or followanother or the two events may be unrelated.
The two events are casually related.
The two events are casually unrelated are saidto be concurrenti.e. they have no effect on eachother.
-
7/26/2019 OOMD Module2 Dynamic Modelling
5/58
Vidhya P.M 5
An event is a one-way transmission ofinformation from one object to another.
In real world, all objects existconcurrently.
An object sending an event to anotherobject may expect a reply but the reply is
a separate event under the control of thesecond object which may or may notchoose to send it.
-
7/26/2019 OOMD Module2 Dynamic Modelling
6/58
Vidhya P.M 6
Every event is a unique occurrence, but we groupthem into event classes and give each event class aname to indicate common structure and behavior.
E.g. flight 123 departs from Delhi and flight 321departs from Rome are instances of event classairplane flight departs having attributes airline flight no,city.
The time at which an event occurs is an implicitattribute of all events.
-
7/26/2019 OOMD Module2 Dynamic Modelling
7/58
Vidhya P.M 7
An event conveys information from one
object to another.
Some classes of events may be simply
signals that something has occurred
while other convey data values i.e.
attributes.
Showing attributes is optional.
-
7/26/2019 OOMD Module2 Dynamic Modelling
8/58
Vidhya P.M 8
Airplane flight departs (airline, flight#, city)
Mouse button pushed (button, location)
Input string entered (text)Phone receiver lifted
Digit dialed (digit)
Event classes and attributes
-
7/26/2019 OOMD Module2 Dynamic Modelling
9/58
Vidhya P.M 9
Scenarios and event traces
A scenario is a sequence of events that occurs
during one particular execution of a system.
The scope of a scenario can vary; it mayinclude all events in the system or it may
include only those events generated by certain
objects in the system.
-
7/26/2019 OOMD Module2 Dynamic Modelling
10/58
Vidhya P.M 10
Caller lifts receiver
Dial tone begins
Caller dials digit (5)
Dial tone endsCaller dials digit (5)
Caller dials digit (4)
Caller dials digit (3)
Caller dials digit (2)
Caller dials digit (1)
Called phone begins ringing
Ringing tone appears in calling phone
Called party answers
Called phone stops ringing
Ringing tone disappears in calling phone
Phones are connected
Called party hangs up
Phones are disconnected
Caller hangs up
Scenario for phone call
-
7/26/2019 OOMD Module2 Dynamic Modelling
11/58
Vidhya P.M 11
The next step after writing scenario is to identify thesender and receiver objects of each event.
The sequence of events and the objects exchangingevents are shown in event trace diagram.
This diagram shows each object as a vertical line andeach event as a horizontal arrow from the sender toreceiver objects.
Time increases from top to bottom.
Sequences of events are shown not their exact timing.
-
7/26/2019 OOMD Module2 Dynamic Modelling
12/58
Vidhya P.M 12
Event trace for phone call
Caller phone line callee
Caller lifts receiver
Dial tone begins
Caller dials digit (5)
Dial tone ends
Caller dials digit (5)
Caller dials digit (4)Caller dials digit (3)
Caller dials digit (2)
Caller dials digit (1)
Called phone begins ringing phone rings
answer phone
ringing stops ringing stops
phones are connected phones connectedCallee hangs up
disconnected disconnected
Caller hangs up
twoconcurrentevents
-
7/26/2019 OOMD Module2 Dynamic Modelling
13/58
Vidhya P.M 13
States
It is an abstraction of the attribute values and links ofan object.
Set of values are grouped together into a stateaccording to properties that affect the gross behavior
of the object. A state specifies the response of the object to input
events.
Response is same for all values within the same stateand may be different for values in different states.
Response of an object to an event may include anaction or change of states by the object.
-
7/26/2019 OOMD Module2 Dynamic Modelling
14/58
Vidhya P.M 14
A state has duration
An event separates two states and a
state separates two events.
In defining states we ignore those
attributes that do not affect the behavior
of the objects.
-
7/26/2019 OOMD Module2 Dynamic Modelling
15/58
Vidhya P.M 15
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.
-
7/26/2019 OOMD Module2 Dynamic Modelling
16/58
idle
Timed- out
disconnected
Busy tone
Fast busy tone
Dial tone
dialing
connecting
ringing
connected
Recorded message
On-hook On-hook
Off-hook
Digit(n)
Invalid novalid
routed
Called phone answers
Called phone hangs up
Trunk busy
Num busy
State diagram for phone line
-
7/26/2019 OOMD Module2 Dynamic Modelling
17/58
Vidhya P.M 17
A state diagram describes the behavior of asingle class.
Since all instances of a class have same
behavior they all share the same statediagram as they all share the same classfeatures.
But as each object has its own attribute values
so each object has its own state. Each object is independent of the other
objects and proceeds as its own pace.
-
7/26/2019 OOMD Module2 Dynamic Modelling
18/58
Vidhya P.M 18
Statediagramscanrepresentone-shotlifecyclesorcontinuousloops.
One-shotdiagramsrepresentobjectswithfinitelives.Aone-shotdiagramhasinitialandfinalstates.
Theinitialstateisenteredoncreationofanobject
Entering thefinalstateimpliesdestructionoftheobject.
-
7/26/2019 OOMD Module2 Dynamic Modelling
19/58
stalemate
emat
One-shot
statediagram
Thedynamicmodelisacollectionofstatediagramsthatinteractwitheachotherviasharedevents.Anobjectmodelrepresentsthestaticstructureofasystem,while
dynamicmodelrepresentsthecontrolstructureofasystem.
Ascenarioistoadynamicmodelasaninstancediagramistoanobjectmodel.
White'sturn
black
moves
Black's
turn
checkmate
whitemoves
stale
checkmate
Blackwins
Draw
Whitewins
Start
finalstate(bull'seye)
initialstate(solidcircle)
Oneshot
-
7/26/2019 OOMD Module2 Dynamic Modelling
20/58
Vidhya P.M 20
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]
-
7/26/2019 OOMD Module2 Dynamic Modelling
21/58
21
Example
Starting
entry / start dial tone
exit / end dial tone
Dialing
entry / number.append(n)
dialed (n)
dialed (n)
[number.isValid()]
-
7/26/2019 OOMD Module2 Dynamic Modelling
22/58
Vidhya P.M 22
Operations
An activity is an operation that takes time to complete.
An activity is associated with a state.
Notation do:A within a state box indicates that activity A startson entry to the state and stops on exit.
An action is an instantaneous operation.
An operation is associated with an event. An action represents an operation whose duration is insignificant
compared to the state diagram e.g. disconnect phone line mightbe an action in response to an on_hook event for phone line.
Actions can also represent internal control operations such assetting attributes or generating other events.
The notation for an action is (/) and the name of action, followingthe name of the event that causes it.
-
7/26/2019 OOMD Module2 Dynamic Modelling
23/58
Vidhya P.M 23
Action for pop-up menu
idle Menu visible
Right button down/display menu
Right button up/erase menu
Cursor moved/highlight menu item
-
7/26/2019 OOMD Module2 Dynamic Modelling
24/58
Vidhya P.M 24
SummaryofNotationforStateDiagramswith
Operations
State1do:activity1
State2do:activity1
Event1 (attributes)[condition1]/action1
-
7/26/2019 OOMD Module2 Dynamic Modelling
25/58
State Chart Diagram vs Sequence Diagram
State chart diagrams help to identify:
Changesto an individual objectover time
Sequence diagrams help to identify The temporal relationship of between objectsover
time
Sequence of operations as a response to one or
more events
-
7/26/2019 OOMD Module2 Dynamic Modelling
26/58
Example of Concurrency within an Object
Emitting
Setting Ready
Up to r eset
Do: Dispense
Cash
Do: EjectCard
Ready
Cash taken
Card taken
Synchronization
Splitting control
-
7/26/2019 OOMD Module2 Dynamic Modelling
27/58
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 executingconcurrently with the others.
2. Object concurrency An object can be partitioned into subsets of states (attributes
and links) such that each of them has its own subdiagram. The state of the object consists of a set of states: one state
from each subdiagram.
State diagrams are divided into subdiagrams by dotted lines.
-
7/26/2019 OOMD Module2 Dynamic Modelling
28/58
Vidhya P.M 28
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.
S f
-
7/26/2019 OOMD Module2 Dynamic Modelling
29/58
Vidhya P.M 29
Sate of car transmission with
generalization
Transmission
Neutral Reverse
Push R
Push N
Forward
First Second Thirdupshift upshift
downshift downshift
Stop
Push N Push F
-
7/26/2019 OOMD Module2 Dynamic Modelling
30/58
StateGeneralization
Generalization is the or-relationship. The states in the nested diagram are all
refinementsofthestateinthehigh-leveldiagram.
States may have substates that inherit the transitions of their superstates.Anytransitionoractionthatappliestoastateappliestoallitssubstates,unless overridden
byanequivalenttransitiononthesubstate.
Asuperstateisdrawnasalargeroundedboxenclosingallof
itssubstates.Substatesinturncanenclosefurthersubstates.WithinstateForward,substateFirstisthedefaultinitialstate.Forwardisjustanabstractclassstate;controlmust
beinarealstate,suchasFirst.
Neutral Reverse
pushR
Second Third
upshift
downshift
First
downshift
stop
Forward
Transmission
pushN
pushFpushN
Statediagramofcartransmission
withgeneralization
defaultsubstate
upshift
abstractstate
inheritedbyeach
gear
superstate
substate
-
7/26/2019 OOMD Module2 Dynamic Modelling
31/58
Anaggregationandits
concurrentstate
diagrams
Car
Ignition Transmission Brake Accelerator
Starting Onreleasekey
Off[Transmissionin Neutral]
Ignitionturnkeytostart
turnkeyoff
-
7/26/2019 OOMD Module2 Dynamic Modelling
32/58
Neutral Reverse
pushR
Second Third
upshift
First
upshiftstop
Forward
Transmission
pushN
pushFpushN
OnOff
releaseaccelerator
downshift
Accelerator
depressacceleratorOnOff
releasebrake
downshift
Brake
depressbrake
-
7/26/2019 OOMD Module2 Dynamic Modelling
33/58
Vidhya P.M 33
Accelerator
Off On
press
Release
Accelerator
Off
Brake
Off On
press
Release
-
7/26/2019 OOMD Module2 Dynamic Modelling
34/58
Vidhya P.M 34
Functional Modeling
-
7/26/2019 OOMD Module2 Dynamic Modelling
35/58
Vidhya P.M 35
It specifies the results of a computationwithout specifying how or when they arecomputed.
It specifies the meaning of operations inobject model and actions in dynamicmodel as well as constraints in objectmodel.
-
7/26/2019 OOMD Module2 Dynamic Modelling
36/58
Vidhya P.M 36
DFD
It shows the functional relationships of the
values computed by a system, including input
values, output values and internal data stores.
A DFD is a graph showing the flow of datavalues from their sources in objects through
processes that transform them to their
destinations in other objects.
-
7/26/2019 OOMD Module2 Dynamic Modelling
37/58
Vidhya P.M 37
Elements of DFD
Processes -> Transform data
Data flow -> move data
Actor ->objects that produce and consumedata.
Data store -> objects that store data
passively.
ProcessName
actorName
Data_storeNameInformation/operation
that modify stored dataInformation received from
stored data
-
7/26/2019 OOMD Module2 Dynamic Modelling
38/58
Vidhya P.M 38
Data Stores
It is a passive object within the graph thatstores data.
It does not generate any operation but merelyresponds to requests to store and access
data. It is drawn as a pair of parallel lines containing
the name of the store.
Input arrows indicate information or operations
that modify the stored data. Output arrows indicate information retrieved
from data store.
In general data store is implemented as a file.
-
7/26/2019 OOMD Module2 Dynamic Modelling
39/58
Vidhya P.M 39
Data store for temprature readings..
Readings
Max temp
Min temp
-
7/26/2019 OOMD Module2 Dynamic Modelling
40/58
Vidhya P.M 40
Data store for bank account
Customerwithdraw
-
Account
balance
Double headed arrow indicates that balance is both an i/p and o/p of
Subtract operation.
-
7/26/2019 OOMD Module2 Dynamic Modelling
41/58
Vidhya P.M 41
Data store for price list for items
Price listItem_name
cost
Find costItem namecost
-
7/26/2019 OOMD Module2 Dynamic Modelling
42/58
Vidhya P.M 42
A data flow that generates an object
used as the target of another operation is
indicated by a hollow triangle at the end
of data flow.
BankAccountselectaccounts
Customer
name
updaterequest
balance
( i/p and o/p)
Selection with an object as result
-
7/26/2019 OOMD Module2 Dynamic Modelling
43/58
Vidhya P.M 43
Creation of new object
Create account Bankaccount
AccountCustomer
Name, deposit
account
-
7/26/2019 OOMD Module2 Dynamic Modelling
44/58
Vidhya P.M 44
Nested DFD
The nesting of a diagram is also called
leveling.
A process can be expanded into another
DFD.
-
7/26/2019 OOMD Module2 Dynamic Modelling
45/58
Vidhya P.M 45
Control Flows
A data flow diagram shows all possible
computation paths for values.
Decisions and sequencing are control
issues that are part of dynamic model.
-
7/26/2019 OOMD Module2 Dynamic Modelling
46/58
Vidhya P.M 46
A control flow is a Boolean value that
affects whether a process is evaluated or
not.
It is shown by a dotted line from a
process producing a Boolean value to
the process being controlled.
-
7/26/2019 OOMD Module2 Dynamic Modelling
47/58
Vidhya P.M 47
customer update
verify
Account
password
amount
cash
Coded password
PasswordOK
balance
-
7/26/2019 OOMD Module2 Dynamic Modelling
48/58
Vidhya P.M 48
Specifying Operations
Each operation may be specified as-
Mathematical functions
Table of input and output values.
Equations
Pre and post conditions
Decisions tables
Pseudo code, etc
-
7/26/2019 OOMD Module2 Dynamic Modelling
49/58
Vidhya P.M 49
Specification of an operation includes a
signature and a transformation.
Signature defines the interface to the
operation i.e. arguments, value returns.
The transformation defines the effect of
an operation i.e. the output values and
the side effects of the operation on itsoperand objects.
-
7/26/2019 OOMD Module2 Dynamic Modelling
50/58
Vidhya P.M 50
Operations can be divided into three
parts-
Queries
Actions
Activities
-
7/26/2019 OOMD Module2 Dynamic Modelling
51/58
Vidhya P.M 51
Query
A query is an operation that has no side
effects on externally visible state of any object.
An action is a transformation that has side
effects on the target object or other objects inthe system reachable from the target object.
Actions can be defined by mathematical
equations, decision trees, decision tables, etc.
-
7/26/2019 OOMD Module2 Dynamic Modelling
52/58
Vidhya P.M 52
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.
-
7/26/2019 OOMD Module2 Dynamic Modelling
53/58
Vidhya P.M 53
constraints
It shows the relationship between two objects at thesame time (frequency and wavelength )Or betweendifferent values of the same object at different times(no of outstanding shares of mutual fund).
It can appear in each model.
Object constraints specify that some objects dependentirely or partially on other objects.
Dynamic constraints specify relationships among thestates or events of different objects.
Functional constraints specify restrictions onoperations.
A constraint between values of an object over time iscalled as invariant i.e. it specifies that some functionsof values remain constant over time.
-
7/26/2019 OOMD Module2 Dynamic Modelling
54/58
Vidhya P.M 54
FM Vs OM & DM
FM shows what has to be done by asystem.
The object model shows the doers- the
object. DM shows the sequences in which the
operations are performed.
The three models come together in theimplementation of methods.
FM is a guide to the methods.
-
7/26/2019 OOMD Module2 Dynamic Modelling
55/58
Vidhya P.M 55
A process is usually implemented as a
method.
Actors and data stores are objects in the
object model.
Data flows are values in object model.
-
7/26/2019 OOMD Module2 Dynamic Modelling
56/58
Vidhya P.M 56
Relative to functional model the object
model shows the structure of the actors,
data store and flows.
Relative to functional model the dynamicmodel shows the sequence in which
processes are performed.
-
7/26/2019 OOMD Module2 Dynamic Modelling
57/58
Vidhya P.M 57
Relative to object model the functional
model shows the operations on classes
and the arguments of each operations.
Relative to object model the dynamicmodel shows the states of each object
and the operations that are performed as
it receives events and changes state.
-
7/26/2019 OOMD Module2 Dynamic Modelling
58/58
Relative to dynamic model the functional
model shows the definition of actions
and activities that are undefined with
dynamic model. Relative to dynamic model the object
model shows what changes state and
undergoes operations.
top related