22
Dillon: CSE470:DYN & FUNC MODELLING 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 MODELLING1 Dynamic Model l Show the temporal order of operations l Control model »Show the sequence of operations that occur

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Dillon: CSE470:DYN & FUNC MODELLING 1

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 2

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 3

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 4

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 5

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 6

Graphical Notation

Ordering of Actions actions on incoming transition entry action activity and event action as appropriate exit action actions on outgoing transition

State 1do:activity

entry/action2exit/action3

event/action4

State 2

. . .

Event(attrs)[cond]/action1

Dillon: CSE470:DYN & FUNC MODELLING 7

Example: Helper_App

Registeringentry/Register(mimetype, this) do: monitor DDE msgs

Ready

do: monitor DDE msgs

Ack/start_service

Wait Changing URL

Ack ChangeURL(file, url)/ Send_file(file, url) Spawn_viewer(appname, file)

Ack

IO_Exception

StopDDE_exception

DDE_exception

Dillon: CSE470:DYN & FUNC MODELLING 8

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 9

Notation for Refinement

Substate-1 Substate-2

Superstate

event 3

event 1

event 2

Dillon: CSE470:DYN & FUNC MODELLING 10

Example: Helper_App

Registeringentry/Register(mimetype, this) do: monitor DDE msgs

Ready

do: monitor DDE msgs

Ack/start_service

Wait

Changing URL

Ack

ChangeURL(file, url)/ Send_file(file, url) Spawn_viewer(. . .)Ack

IO_E

xcep

tion

StopDDE_exception

Dillon: CSE470:DYN & FUNC MODELLING 11

Example:Browser_Listener

Registeringentry/Register(this)

Ready

Ack/start_service

Wait

Ack

Cha

ngeU

RL

(fil

e,ur

l)

[url

=la

stU

rl o

r ty

pe/=

HT

ML

]

StopDDE_exception

Cha

ngeU

RL

(fil

e,ur

l) [

url/

=la

stU

rl

and

type

=H

TM

L]

/ se

ndU

RL

(url

,fra

me)

Dillon: CSE470:DYN & FUNC MODELLING 12

Notation for Concurrency

Substate-1

Substate-2

Substate-3

Substate-4

Superstate

event 1

event 2

Dillon: CSE470:DYN & FUNC MODELLING 13

Example:Browser_Slave

Registering

entry/Register(this)

Ready

Ack/start_service

AckChangeURL(file,url) / UpdateFrameVector (frame)

Stop

DDE_exception

Wait

Wait

RecURL(url,frame) / B_activate

Ack / B_OpenURL(url,frame)

Ack

Frame_manager Rec_URL_manager

Dillon: CSE470:DYN & FUNC MODELLING 14

Example: WEB Class

Browser_Wrapper Mreceiver Browser_Slave

Web_Student

Web_Instructor

Browser_Wrapper Msender Browser_Listener

Helper_App1

Helper_App9

...

Dillon: CSE470:DYN & FUNC MODELLING 15

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 16

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 17

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 18

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 19

Graphical Notation

Data flow between Processes:Process:

Process name Process name Process namedata name

Data store or file object:

Name of data store

Name of data store

Data flow that results in a data store:

Dillon: CSE470:DYN & FUNC MODELLING 20

Graphical Notation (cont.)

Actor objects (as source or sink of data:

Process name Actor2Actor1d2d1

Composition, duplication, and decomposition of data values:

d1

d2

composite d1 composited1

d2

Dillon: CSE470:DYN & FUNC MODELLING 21

Example: Banking application

Bank Selectaccounts

Customer

name

Update

Account

request

balance

Dillon: CSE470:DYN & FUNC MODELLING 22

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