executable object modelling with state charts

31
EXECUTABLE OBJECT MODELLING WITH STATE CHARTS By: David Harel & Eran Grey Presenter: Elizabeth Antony CISC 836

Upload: vivian

Post on 22-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

Executable Object Modelling with State Charts. By: David Harel & Eran Grey Presenter: Elizabeth Antony CISC 836. Models. Desirable properties of Models. Models for the development of Object Oriented System should be: Behaviorally expressive Well structured And intuitive - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Executable Object Modelling with State Charts

EXECUTABLE OBJECT MODELLING WITH STATE

CHARTSBy: David Harel & Eran GreyPresenter: Elizabeth Antony

CISC 836

Page 2: Executable Object Modelling with State Charts

Models

Page 3: Executable Object Modelling with State Charts

Desirable properties of Models Models for the development of Object

Oriented System should be: Behaviorally expressive Well structured And intuitive Semantics should be rigorously defined

Page 4: Executable Object Modelling with State Charts

Model properties cont’d Semantics not well defined => produce fully

executability and automatic code synthesis impossible

Statecharts must capture not only the state of the object as a precondition to service requests, but also the dynamics of the object’s internal behavior in responding to those requests and in maintaining relationships with other objects.

Page 5: Executable Object Modelling with State Charts

This paper ..Focuses on developing an integrated set of diagrammatic languages for object modelling, built around Statecharts.Language set includes :

Object Model DiagramsStateCharts

Page 6: Executable Object Modelling with State Charts

StateCharts Statecharts extend statemachines or

state diagrams with three elements namely, hierarchy, concurrency and communications

Complex systems such as multicomputer real time systems, communication protocols and digital control units

Source: [1]

Page 7: Executable Object Modelling with State Charts

Automated Rail Car System

Each car Cruise control Engine Max speed till it is within

80 yards from another car Each Platform

Single car Car within 100 yards from the terminal

platform and entrance segments allocated

Car departing terminal after being parked for 90 secs Exit segment allocated Turns off the destination indicator

Page 8: Executable Object Modelling with State Charts

Object Model DiagramOne diagram/systemClassesStructural relationships unidirectional bidirectional partof

RelationshipName or role

its

Car can refer to a set of its terminals itstopsAt

Page 9: Executable Object Modelling with State Charts

Navigation Expressions

Passenger->itsCar->stopsAtSet of all terminals that the carCarrying the passenger stopsAt

System->itsTerminal[1:6]

Is the object model diagram concerned with the static aspects only?

System refers to an explicit composite objectthat encloses the entire model

Page 10: Executable Object Modelling with State Charts

Behavioral semantics Initialisation:

What object instances are created at the start and how the attributes and relationships with other objects are set up.

Dynamics over time: Dynamics concerns the way models behave

while running. Triggers like events, operations change the

model status

Page 11: Executable Object Modelling with State Charts

Initialisation – composite structures

Composite structures Associations initialisation scripts

Page 12: Executable Object Modelling with State Charts

Initialisation - Associations Setting up relation ships and defining

how instances collaborate Unambiguous Ambiguous but bounded unworkable

Unambiguous

Unworkable

Page 13: Executable Object Modelling with State Charts

Initialisation – initialising scripts

for (int car = 0; car < 6; car++){System -> itsCar[2*car] =

new Car(System -> itsTerminal[car]);System -> itsCar[2*car+1] =

new Car(System -> itsTerminal[car])}

Page 14: Executable Object Modelling with State Charts

StateCharts An extension to statemachines and

statediagrams Used to model complex systems Describe how objects communicate and

collaborate and how they carry out their internal behavior

It must also reflect issues such as inheritance.

Page 15: Executable Object Modelling with State Charts

StateCharts – cont’d Object Communication and Collaboration:

Objects generate events (asynchronous) Invoke operation on an other object

(synchronous)

Obj B

Obj A

ObjC

Queue

Server

<Server> - > gen((<event name>(<parameters>))gen(<event name>(<parameters>)) // events that are generated within and

limited to the present state chart

Page 16: Executable Object Modelling with State Charts

Object Communication and Collaboration: Events

Event delegation If server A is a composite object

Who responds to the event e addressed to A ?Composite object endowed with forwarding spec

delegate(e,B) delegate(e,B,C,…) broadcast(e)

Delegation continues down the tree of composites

Page 17: Executable Object Modelling with State Charts

Object Communication and Collaboration : Operations

<server> -> <operationname> (<parameters>)

Method call within the called object <operationname>(<parameters>)

Page 18: Executable Object Modelling with State Charts

Object Behavior Statecharts can be

Full State hierarchyMultilevel orthogonal ComponentsHistory connectors andBroadcast communication

used to describe “modal” `Partial statecharts

Only to specify pre and post conditions of operations Discard concurrent states and broadcast mechanism

Page 19: Executable Object Modelling with State Charts

Object Behavior – Triggers and Actions

Reactions of the form Trigger[condition]/action-list

Reactions can be adorned on the transition arrow or within a state’s reaction spec

A trigger – either an event expression or an operation request

Action – sequences of event generation expressions, operation invocations, and C++ statements

Page 20: Executable Object Modelling with State Charts

Object Behavior -Actions in(s)

test if the current statechart configuration includes the state s

tm(ev,n) occurs t time units after event ev; the clock is

reset to 0 upon each occurrence of event ev

Page 21: Executable Object Modelling with State Charts

Object Behavior - Actions Creating and deleting instances

<object> = new <classname> (<parameters>)

delete(object)

Adding and removing components from a composite instance <new component> = add<component

name>() Remove<component name>(<component

type>) Ex., stopsAt - > add(term)

Car is now scheduled to stop at the term also

Page 22: Executable Object Modelling with State Charts

Actions cont’d Actions for maintaining association

relationships Adding an object to the other end of a

relationship

<rolename> - > add(<objectname>) <rolename> - > remove(<object name>)

Page 23: Executable Object Modelling with State Charts

Statechart cont’d Entrance to the statechart’s top level

state is the initialisation entrance for any newly created instance of the object.

A reaction attached to the top level default arrow serves as an intialisation script for instances of that class.

Page 24: Executable Object Modelling with State Charts

Top level state chart - Car

Page 25: Executable Object Modelling with State Charts

Arrival portion

Page 26: Executable Object Modelling with State Charts

Departure portion

Page 27: Executable Object Modelling with State Charts

CarHandler Statechart

Page 28: Executable Object Modelling with State Charts

InheritanceEstablishing relationship between statecharts of a parent class A and its inherited subclass B:

Base the two statecharts on the same underlying state/transition topology.

Modify states by : decomposing a basic state by Or (substates) or by And(into orthogonal components)Modify the conditions and change the action-list by deleting some actions and adding new ones.

Page 29: Executable Object Modelling with State Charts

About the paper.. At the time the paper was written (1996),

Event delegation was not implemented. This paper does not talk about concurrency Inheritance Rhapsody tool was not fully developed. I-Logix released Rhapsody in 1996 Now it is one of the products of IBM Rational

Software Unit.

Page 30: Executable Object Modelling with State Charts

http://homepage.cs.uiowa.edu/~fleck/181content/statecharts.pdf

Harel, D.; Gery, E., "Executable object modeling with statecharts," Computer , vol.30, no.7, pp.31,42, Jul 1997

Statecharts: a visual formalism for complex systems by David Harel , Department of Applied Mathematics, The Weizmann Institute of Science, Rehovot, Israel,1987

Page 31: Executable Object Modelling with State Charts

Thank you.