Transcript lec4.ppt

Dynamic Model
Show the temporal order of operations
 Control model

» Show the sequence of operations that
occur in response to external stimuli
» Do not worry about
– what operations do
– what they operate on
– how they are implemented
Dillon: CSE470:DYN & FUNC MODELLING
1
Dynamic Model

Consists of multiple state diagrams
» One for each class with important dynamic
behavior
» Shows
– states of objects and activities performed in
states
– conditions under which events cause
transitions
– transitions and actions produced by events
Dillon: CSE470:DYN & FUNC MODELLING
2
Terminology

States - determined by the values of an
object’s attributes and links
» have a duration in time
» may be associated with activities

Activities - operations performed by an
object
» take time to complete
Dillon: CSE470:DYN & FUNC MODELLING
3
Terminology

Events - external stimuli
» instantaneous
» may produce state transitions
» may produce actions

Conditions - boolean functions of object
values
» “guard” state transitions
Dillon: CSE470:DYN & FUNC MODELLING
4
Terminology

Actions - instantaneous operations
performed by an object
Triggered by
» an event that produces a state transition
» entering a state
» exiting a state
» an event that does not cause a state transition
– so entry and exit actions are not performed
Dillon: CSE470:DYN & FUNC MODELLING
5
Graphical Notation
State 1
Event(attrs)[cond]/
action1
do:activity
entry/action2
exit/action3
event/action4
State 2
...
Ordering of Actions





actions on incoming transition
entry action
activity and event action as appropriate
exit action
actions on outgoing transition
Dillon: CSE470:DYN & FUNC MODELLING
6
Example: Helper_App
Registering
entry/Register(mimetype, this)
do: monitor DDE msgs
Ack/start_service
DDE_exception
Stop
DDE_exception
Ready
do: monitor DDE msgs
Ack
Wait
IO_Exception
ChangeURL(file, url)/
Send_file(file, url)
Spawn_viewer(appname, file)
Dillon: CSE470:DYN & FUNC MODELLING
Ack
Changing
URL
7
Nesting State Diagrams

Helps organize and modularize SDs
» A way to manage complexity

Two forms of nesting
» Refinement
– add detail to a state
– permits inheritance of transitions
» Concurrency (aggregation)
– aggregates objects, each with their own SDs
Dillon: CSE470:DYN & FUNC MODELLING
8
Notation for Refinement
Superstate
event 1
Substate-1
event 3
Dillon: CSE470:DYN & FUNC MODELLING
Substate-2
event 2
9
Example: Helper_App
Registering
entry/Register(mimetype, this)
do: monitor DDE msgs
Ack/start_service
Ready
do: monitor DDE msgs
IO_Exception
Wait
Ack
ChangeURL(file, url)/
Send_file(file, url)
Spawn_viewer(. . .)
Ack
Changing
URL
DDE_exception
Stop
Dillon: CSE470:DYN & FUNC MODELLING
10
Ack/
start_service
Ready
Ack
Wait
ChangeURL(file,url) [url/=lastUrl
and type =HTML] /
sendURL(url,frame)
Registering
entry/Register(this)
ChangeURL(file,url) [url=lastUrl
or type/=HTML]
Example:Browser_Listener
DDE_exception
Stop
Dillon: CSE470:DYN & FUNC MODELLING
11
Notation for Concurrency
Superstate
event 1
Substate-1
Substate-3
Substate-2
Substate-4
event 2
Dillon: CSE470:DYN & FUNC MODELLING
12
Example:Browser_Slave
Frame_manager
Registering
Rec_URL_manager
DDE_exception
Wait
entry/Register(this)
RecURL(url,frame) /
B_activate
Ack/
start_service
Stop
Ready
Ack
ChangeURL(file,url) /
UpdateFrameVector
(frame)
Ack /
B_OpenURL(url,frame)
Ack
Wait
Dillon: CSE470:DYN & FUNC MODELLING
13
Example: WEB Class
Web_Student
Browser_Wrapper
Mreceiver
Browser_Slave
Web_Instructor
Helper_App1
Browser_Wrapper
Msender
Browser_Listener
..
.
Helper_App9
Dillon: CSE470:DYN & FUNC MODELLING
14
Dynamic Model: Creation
Tips

Create SDs only for object classes with
meaningful dynamic behavior

Check consistency between
» SDs on shared activities
» SDs and object model

Use scenarios to
» Begin construction of SDs
» Check completeness of SDs
Dillon: CSE470:DYN & FUNC MODELLING
15
Dynamic Model: Creation Tips
(cont.)

Let application determine granularity

Distinguish between activities and actions

Make use of entry and exit actions for multiple
transitions

Make use of nested SDs to reduce complexity

Distinguish SDs for super and subclasses
Dillon: CSE470:DYN & FUNC MODELLING
16
Functional Model

Describes computations within a system
» Specifies what happens
» Shows how output values are derived from
input values
» Is not concerned with when computations
are performed

Consists of multiple data flow (DF)
diagrams
Dillon: CSE470:DYN & FUNC MODELLING
17
Terminology

Process - transforms data values

Data flow - connects output of a process or
object to the input of another process or obj

Actor - active object that drives the DF by
producing or consuming data values

Data store - passive object that stores data
for later use
Dillon: CSE470:DYN & FUNC MODELLING
18
Graphical Notation
Process:
Data flow between Processes:
data name
Process name
Data store or file object:
Name of data
store
Dillon: CSE470:DYN & FUNC MODELLING
Process name
Process name
Data flow that results in a
data store:
Name of data
store
19
Graphical Notation (cont.)
Actor objects (as source or sink of data:
d1
Actor1
d2
Actor2
Process name
Composition, duplication, and decomposition of data values:
d1
d1
composite
d2
Dillon: CSE470:DYN & FUNC MODELLING
d1
composite
d2
20
Example: Banking application
accounts
Bank
Account
Select
name
Customer
Dillon: CSE470:DYN & FUNC MODELLING
balance
request
Update
21
Functional Model: Creation
Tips

Create FM only for objects/processes with
meaningful data flow

Start simple
» one process with correct inputs and outputs

Refine to next level by expanding the process

Continue to refine one process at a time

Check consistency between the inputs and
outputs
Dillon: CSE470:DYN & FUNC MODELLING
22