Title: Dynamically creating objects and sequencing operations
1Dynamically creating objects and sequencing
operations
- Cliff Jones
- University of Newcastle
- 2005-06-06
2On the expectation of a WG2.3 topic
- in the tradition of 2.3, this is something Im
trying to sort out for myself - but
- ? apparently it is now expected to work up from
the (legacy) code ?
3POOL example
- class stack
- var
- method push(i item)
- method pop() item
- body
- initialize
- do forever
- if then answer(push)
- else answer(pop, push)
- fi
- od
4OO-like structuring in specifications
- Id like to look at two issues
- how to sequence operations
- how to create objects
- first some background
5A dichotomy
- state based specification techniques
- VDM, Z, B, agent-B
- good for big systems understand from data
- one can see (or design) a system from S
- process algebras
- CSP, CCS, ?-calculus
- states as process indices (but another notion
below) - good for intricate sequencing (e.g. deadlocks)
6My interest(specification and) development
- can be done in, say, CSP
- CCS etc goes more for bi-simulation
- but it has always felt more natural to
- get an abstract state-based spec
- reify data
- decompose operations
- and next splitting atoms
- cf. CBJs Prato talk
7Modularising state based specs
- VDM
- initially none
- operation quotation
- VVSL (as in CDIS)
- VDM (as in VDM ToolSet)
- Z
- everything is a schema
- no pre-conditions!
- B
- machines/operations
8Sequencing operations
- VDM
- all, always available
- pre-conditions are to be respected
- one proves this!
- but there is a procedural language as well!
- B
- originally operations (pre P then S end)
- action systems/ Event-B
- when conditions define firing
9OO is a GoodThing? (in design)
- sometimes as essence of system
- come back to how modelled?
- sometimes as an implementation idea
- CBJ used several times as reification
- modularisation (better than many specification
languages) - control of interference
- local instance variables
- unique references create islands of computation
- shared references when interference necessary
- option to control sequencing
10Look at combining processes/states
- done in Ada
- by Abrial!!
- POOL
- ????
- dropped (after MIWs observation)
11So, two ways of sequencing
- process descriptions
- in the style of POOL
- guards
- when in Event-B
- possible to hack at this level abstract PC
- Id like to view them as refinements
- in either direction
- would combinations be useful?
- but I want to achieve even more
12?obl
- language itself
- typed references
- recognise unique references
- no inheritance (yet)
- see as design notation (cf. VDM sequential)
- use with implemented OOLs (e.g. Eiffel)
- semantics (as basis of meta proofs)
- SOS
- map to ?-calculus
13?obl
Sort class vars v nat ? nil l unique ref(Sort)
? nil insert(x nat) method return if
is-nil(v) then (v ? x l ? new Sort) elif v ? x
then l.insert(x) else (l.insert(v) v ?
x) fi test(x nat) method Bool if is-nil(l) ?
x ? v then return false elif x v then return
true else delegate l.test(x) fi . . . end Sort
14Mapping (i)
- Q !IQ
- IQ qu.BQ
- thus
- new Q q(u).
15Mapping (ii)
- IQ
- \New\widetildes\widetildea
- (v\sbnil l\sbnil
- \outpqu. B\sbQ)
16We have
- a nice mapping ???? to ?-calculus
- new C maps to a reference to replication
- strictly, a communication with a name inside a
replicator which cause a new instance to exist - we can therefore have dynamic creation of
objects/machines/
17Contrast
- Michael Butlers paper
- tokens ? Cust ? 0..sx in the specification
- a strange (twin) SOS
- cbjs SOS of COOL
- map Oid to ObjInfo
- is a semantic object
- the SOS rules create this mapping
- so my semantics of POOL
- would look rather different from Michaels
- might have a program counter into process
expression!!
18Technical issue(s)
- failure(s)
- in two senses
- internal choice (vs. external)
- divergence(s)
19Implementation questions
- CSP handshake is non-trivial
- Event-Bs when clause looks less efficient than
CARHs monitors - assuming
20So, sequencing operations VDM OO
?-calculus(held together by reification)