Docsity

Dynamic Modeling: Understanding Systems with Statecharts and Finite State Machines, Slides of Software Project Management

Partial preview of the text

Download Dynamic Modeling: Understanding Systems with Statecharts and Finite State Machines and more Slides Software Project Management in PDF only on Docsity!

1

Dynamic Modeling

Lecture # 37

2

Dynamic Modeling

  • Temporal relationships are difficult to

understand

  • A system can first be understood by

examining its static structure and therelationships that exist among differentelements at single moment in time

4

Dynamic Modeling

  • Control is an aspect of a system that

describes the sequences of operationsthat occur in response to externalstimuli, without consideration of whatthe operations do, what they operateon, or how they are implemented

5

Dynamic Modeling

  • Dynamic modeling deals with flow of

control, interactions, and sequencing ofoperations in a system of concurrently-active objects

  • Major dynamic modeling concepts are

events

, which represent external stimuli, and

states

, which represent values of objects

7

Dynamic Modeling

  • The view of an object in isolation is a state

machine – a view of an object as it respondsto events based on its current state,performs actions as part of its response, andtransitions to a new state

  • This is displayed in state chart diagrams in

UML

8

Dynamic Modeling

  • The view of a system of interacting objects

is a collaboration, a context-dependent viewof objects and their links to each other,together with the flow of messages betweenobjects across data links

  • Collaboration and sequence diagrams are

used for this view in UML

10

Finite State Machines

  • A finite state machine (FSM) is a

hypothetical machine that can be inonly one of a given number of states atany specific time

  • In response to an input, the machine

generates an output and changes state

11

Finite State Machines

  • Both the output (O) and the next state

(S

N

) are purely functions of the current

state (S

C

) and the input (I)

  • S

N

= F(S

C

, I)

  • O = G(S

C

, I)

13

State Transition Diagrams

  • A circle denotes a state• A directed arc connecting two states

denotes the potential to transition betweenthe two indicated states

  • A label on the arc, which has two parts

separated by a slash, means the input thattriggers the transition and the output withwhich the system responds

  • Mealy model of state transition diagrams

14

State Transition Diagrams

Input/Output

State

1

State

2

16

State Transition Diagrams

Input/Output

State

1

State

2

17

State Transition Diagrams

  • Another model exists for state transition

diagrams, Moore model, in which systemresponses are associated with the staterather than the transition between states

  • On Moore STDs, arcs are labeled with only

the stimulus name, and circles are labeledwith the state name and the system response

19

Statecharts

  • Statecharts are an extension to finite

state machines, proposed by Harel

  • They provide a notation and a set of

conventions that facilitate thehierarchical decomposition of finitestate machines and a mechanism forcommunication between concurrentfinite state machine

20

Statecharts

  • Statecharts allow a transition to be a

function of not only an externalstimulus but also the truth of aparticular condition

S

1

S

2

I(C)