On the Prototype-Based Object Orientation in Modeling and Simulation - - PowerPoint PPT Presentation

on the prototype based object orientation in modeling and
SMART_READER_LITE
LIVE PREVIEW

On the Prototype-Based Object Orientation in Modeling and Simulation - - PowerPoint PPT Presentation

On the Prototype-Based Object Orientation in Modeling and Simulation ASIS 2006 Vladimr Janouek On the Prototype-Based Object Orientation in Modeling and Simulation p.1/22 Outline Context Class-Based and Prototype-Based Object


slide-1
SLIDE 1

On the Prototype-Based Object Orientation in Modeling and Simulation

ASIS 2006

Vladimír Janoušek

On the Prototype-Based Object Orientation in Modeling and Simulation – p.1/22

slide-2
SLIDE 2

Outline

  • Context
  • Class-Based and Prototype-Based Object Orientation
  • Exploratory programming (and image-based systems)
  • DEVS formalism for modeling
  • Prototype-Based OO Modeling, Exploratory Modeling
  • Summary

On the Prototype-Based Object Orientation in Modeling and Simulation – p.2/22

slide-3
SLIDE 3

Context

  • OOPN/PNtalk

high-level visual formalism used as a full-featured programming language

  • SmallDEVS

hierarchical component framework based on systems theory featuring openness, reflectivity, interactivity

  • PNtalk is now being nested to SmallDEVS as one of high-level

languages for component specification

  • App. area:

Model-based development, Model continuity Multiparadigm modeling Evolvable and reflective models

  • Prototype-Based OO and reflectivity are the SmallDEVS aspects

being discussed in this talk

On the Prototype-Based Object Orientation in Modeling and Simulation – p.3/22

slide-4
SLIDE 4

Approaches to the Object Orientation

  • Class-based OO
  • Simula
  • Smalltalk (classes are objects, methods are objects, image),
  • C++, Java - mainstream
  • Prototype-based OO
  • Self (Smalltalk-like system)
  • JavaScript, ... (for scripting)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.4/22

slide-5
SLIDE 5

Prototype-Based Object Orientation

  • No key feature of class-based approach is lost
  • More flexibility in object building, reusability and behavior sharing.
  • Real bottom-up development - abstracions are obviously

constructed after some experience with the concrete individuals.

  • One problem: Not in mainstream
  • hardly integrable with file-based approach,
  • not supported by UML sufficiently yet,
  • nothing is static, everything can change - more metamodeling is needed more

sofisticated tools are needed

On the Prototype-Based Object Orientation in Modeling and Simulation – p.5/22

slide-6
SLIDE 6

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-7
SLIDE 7

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-8
SLIDE 8

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects
  • Image-Based systems - live objects in persistent object memory

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-9
SLIDE 9

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects
  • Image-Based systems - live objects in persistent object memory
  • Source code is not important - text can be generated from live
  • bjects

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-10
SLIDE 10

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects
  • Image-Based systems - live objects in persistent object memory
  • Source code is not important - text can be generated from live
  • bjects
  • Incremental development (classes and methods in Smalltalk,
  • bjects and slots in Self)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-11
SLIDE 11

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects
  • Image-Based systems - live objects in persistent object memory
  • Source code is not important - text can be generated from live
  • bjects
  • Incremental development (classes and methods in Smalltalk,
  • bjects and slots in Self)
  • Tools for programming - browsers, inspectors, workspaces,
  • utliners

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-12
SLIDE 12

Exploratory programming

  • Exploring a state of a running system, editing live objects at run

time

  • Reflectivity - objects can explore and edit objects
  • Image-Based systems - live objects in persistent object memory
  • Source code is not important - text can be generated from live
  • bjects
  • Incremental development (classes and methods in Smalltalk,
  • bjects and slots in Self)
  • Tools for programming - browsers, inspectors, workspaces,
  • utliners
  • The gap between ’what is programmed’ and ’what is running’ is

eliminated.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.6/22

slide-13
SLIDE 13

DES Modeling and Simuation

Popular approaches

  • Quasi-parallel processes - Simula, ...
  • State-centered formalisms - DEVS, Petri nets
  • well suitable for reflectivity studies

(simplicity, explicit state, clonable)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.7/22

slide-14
SLIDE 14

DES Modeling and Simuation

Popular approaches

  • Quasi-parallel processes - Simula, ...
  • State-centered formalisms - DEVS, Petri nets
  • well suitable for reflectivity studies

(simplicity, explicit state, clonable) DEV S = (X, S, Y, δint, δext, λ, ta) X is a set if input values S is a set of states Y is a set of output values δint : S − → S is the internal transition function δext : Q × X − → S is the external transition function, where Q = {(s, e) | s ∈ S, 0 ≤ e ≤ ta(s)} is the set of all states e is the time passed since the last transition λ : S − → Y is the output function ta : S − → R+0,∞ is the time advance function

On the Prototype-Based Object Orientation in Modeling and Simulation – p.7/22

slide-15
SLIDE 15

DEVS

  • hierarchical component architecture, static or dynamic structure

On the Prototype-Based Object Orientation in Modeling and Simulation – p.8/22

slide-16
SLIDE 16

DEVS

  • hierarchical component architecture, static or dynamic structure
  • state machines represent a lower level approach than processes,

but it is very well suited for exploring and modification (in theory, as well as in real implementations)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.8/22

slide-17
SLIDE 17

DEVS

  • hierarchical component architecture, static or dynamic structure
  • state machines represent a lower level approach than processes,

but it is very well suited for exploring and modification (in theory, as well as in real implementations)

  • higher-level paradigms can be mapped or wrapped (processes,

PNs, statecharts)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.8/22

slide-18
SLIDE 18

DEVS Implementation

  • Mainstream approach:
  • Atomic components are defined as classes
  • Coupled components as well
  • Structure of coupled components can obviously change

(ports, coupling, instantiation)

  • No new atomic components can be introduced at run time

On the Prototype-Based Object Orientation in Modeling and Simulation – p.9/22

slide-19
SLIDE 19

DEVS Implementation

  • Mainstream approach:
  • Atomic components are defined as classes
  • Coupled components as well
  • Structure of coupled components can obviously change

(ports, coupling, instantiation)

  • No new atomic components can be introduced at run time
  • SmallDEVS approach:
  • Both Class-based and prototype-based OO modeling

supported

  • All components can arbitrarily change at runtime, new

components can arise

On the Prototype-Based Object Orientation in Modeling and Simulation – p.9/22

slide-20
SLIDE 20

Prototypes in Smalltalk

  • Object creation:

aPrototypeObject := PrototypeObject new. anotherPrototypeObject := aPrototypeObject clone.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.10/22

slide-21
SLIDE 21

Prototypes in Smalltalk

  • Object creation:

aPrototypeObject := PrototypeObject new. anotherPrototypeObject := aPrototypeObject clone.

  • Slots and methods exploring:

aPrototypeObject slotNames aPrototypeObject methodNames aPrototypeObject perform: aSlotName aPrototypeObject methodSourceAt: methodName

On the Prototype-Based Object Orientation in Modeling and Simulation – p.10/22

slide-22
SLIDE 22

Prototypes in Smalltalk

  • Object creation:

aPrototypeObject := PrototypeObject new. anotherPrototypeObject := aPrototypeObject clone.

  • Slots and methods exploring:

aPrototypeObject slotNames aPrototypeObject methodNames aPrototypeObject perform: aSlotName aPrototypeObject methodSourceAt: methodName

  • Slots and methods editing:

aPrototypeObject addSlots:{ ’name1’ -> anObject. ’name2’ -> anotherObject}. aPrototypeObject addMethod: ’messageSelector codeOfTheMethod’. aPrototypeObject removeSlots: { ’name1’.’name2’}. aPrototypeObject removeMethod: ’messageSelector’.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.10/22

slide-23
SLIDE 23

Behavior Sharing

traits + delegation (dynamic inheritance):

aPrototypeObject addDelegates:{ ’name1’ -> aTrait. ’name2’ -> anotherTrait}. aPrototypeObject removeDelegates:{ ’name1’. ’name2’ } aPrototypeObject delegateNames.

well-known objects (traits and prototypes) are stored in some globally available structure

On the Prototype-Based Object Orientation in Modeling and Simulation – p.11/22

slide-24
SLIDE 24

Atomic DEVS Incremental Construction

model := AtomicDEVSPrototype new. model addSlots: {...}. model addInputPorts: {...}. model addOutputPorts: {...}. model addDelegates: {...}. model intTransition: ’...’. model extTransition: ’...’. model outputFnc: ’...’. model timeAdvance: ’...’. Exploring and editing slots, ports, methods, delegates: slotNames, removeSlots, ....

On the Prototype-Based Object Orientation in Modeling and Simulation – p.12/22

slide-25
SLIDE 25

Coupled DEVS Incremental Construction

model := CoupledDEVSPrototype new. model addInputPorts: { name1. name2.. ... }. model addOutputPorts: { name1. name2. ... }. model addComponents: { name1 -> aComponent1. name2 -> aComponent2. ... }. model addCouplings: { #(component1 port1) -> #(component2 port2). #(component3 port3) -> #(component4 port4). .... }. Exploring and editing ports, components, couplings: inputPortNames, removeInputPorts, couplings, removecouplings ....

On the Prototype-Based Object Orientation in Modeling and Simulation – p.13/22

slide-26
SLIDE 26

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-27
SLIDE 27

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start. aModel2 := aModel copy. aSimulation2 := aSimualtion copy.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-28
SLIDE 28

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start. aModel2 := aModel copy. aSimulation2 := aSimualtion copy.

Editig ports, couplings, slots, methods, delegates is possible even during simulation

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-29
SLIDE 29

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start. aModel2 := aModel copy. aSimulation2 := aSimualtion copy.

Editig ports, couplings, slots, methods, delegates is possible even during simulation A snapshot of a simulation can be used as a model

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-30
SLIDE 30

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start. aModel2 := aModel copy. aSimulation2 := aSimualtion copy.

Editig ports, couplings, slots, methods, delegates is possible even during simulation A snapshot of a simulation can be used as a model Persistent repository for models and simulations:

MyRepository at: ’/Simulations/MySimulation’ put: s. (MyRepository at: ’/Simulations/MySimulation’) inspect.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-31
SLIDE 31

Operating system

Support for manipulation with models and simulations

s := model getSimulatorRT. s stopTime: Float infinity. s RTFactor: 1. s start. aModel2 := aModel copy. aSimulation2 := aSimualtion copy.

Editig ports, couplings, slots, methods, delegates is possible even during simulation A snapshot of a simulation can be used as a model Persistent repository for models and simulations:

MyRepository at: ’/Simulations/MySimulation’ put: s. (MyRepository at: ’/Simulations/MySimulation’) inspect.

Serialization of models and simulations (for storing to disk or for migration)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.14/22

slide-32
SLIDE 32

SmallDEVS System

On the Prototype-Based Object Orientation in Modeling and Simulation – p.15/22

slide-33
SLIDE 33

Visual tools for exploratory modeling

On the Prototype-Based Object Orientation in Modeling and Simulation – p.16/22

slide-34
SLIDE 34

Visual tools for exploratory modeling

On the Prototype-Based Object Orientation in Modeling and Simulation – p.17/22

slide-35
SLIDE 35

Visual tools for exploratory modeling

On the Prototype-Based Object Orientation in Modeling and Simulation – p.18/22

slide-36
SLIDE 36

Conclusion

Why DEVS?

  • computer supported systems theory
  • inteligent systems modeling, simulation, design (NASA)
  • DEVS standardization in progress, HLA compatibility
  • other formalism can be mapped and/or wrapped

On the Prototype-Based Object Orientation in Modeling and Simulation – p.19/22

slide-37
SLIDE 37

Conclusion

Why DEVS?

  • computer supported systems theory
  • inteligent systems modeling, simulation, design (NASA)
  • DEVS standardization in progress, HLA compatibility
  • other formalism can be mapped and/or wrapped

Why prototype-based exploratory modeling with SmallDEVS?

  • real bottom-up approach (from concrete examples to abstractions)
  • "understanding by modeling" is more concrete - live objects,

no "dead source code"

  • reflectivity and concretness of prototype-based approach makes

no difference between a model and any snapshot of a running simulation

  • almost unlimited automatic evolution of models during simulation

is possible and the resulting model is fully available for exploration by standard tools for modeling

On the Prototype-Based Object Orientation in Modeling and Simulation – p.19/22

slide-38
SLIDE 38

Relations with PNtalk

Object orientation vs. DEVS

  • OO deals with dynamically appearing and disappearing instances
  • f classes.
  • Message sendings.
  • No explicit of object interconnections, no visible structure.
  • Only classes are static. Only classes are maintainable.
  • DEVS deals with static hierarchical structures of objects.

Dynamic structure???

  • No direct message sending.

Explicit, visible connections.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.20/22

slide-39
SLIDE 39

Relations with PNtalk

Merging dynamic objects (e.g. PNtalk) and DEVS

  • DEVS focusses to objects (similarly to Prototype Objects).

Classes are not needed.

  • DEVS can be animated using reflection (dynamic structure,

dynamic atoms). Structure remains visible.

  • DEVS offers component structure to object systems
  • atomic component can encapsulate communicating objects
  • atoms can be simple state machines as well as complex and

dynamic object structures

  • simple event-based component interface allows for effective

composability

  • hierarchical component structures can be dynamic and visible

at the same time

  • component level is easily maintainable and has sound

theoretical background

  • atomic level maintainability depends on particular formalism

(FSA, ASM, Statecharts, Petri nets, LISP , Prolog, ...)

On the Prototype-Based Object Orientation in Modeling and Simulation – p.21/22

slide-40
SLIDE 40

PNtalk TO DO

To be fully interoperable with SmallDEVS, verification tools and external world

  • Asynchronous ports compatible with DEVS ports
  • Reflective access to state for clonning and serialization
  • ...

Partially done.

On the Prototype-Based Object Orientation in Modeling and Simulation – p.22/22