GIPA

968 views

Published on

GIPA by Reinier van Oosten, ESUG09, Brest, France

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
968
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

GIPA

  1. 1. Genera&ng
Integrity
Preserving
 Associa&ons,
 The
First
step
to
Biome
 Reinier
van
Oosten
 VOOC
 VOOC
 1

  2. 2. What
is
Gipa
 •  Gipa
is
a
set
of
parameterized
implementa&on
level
 paDern
classes.
 •  These
can
be
used
to
generate
methods
and
variables
 in
domain
model
classes.
 •  The
paDerns
describe
a
type
of
associa&on
and
their
 composing
roles.
 •  The
current
focus
of
Gipa
is
on
structure
associa&ons
 like
1
to
n
rela&onship.
 •  The
focus
of
Gipa
is
on
integrity
preserva&on.
 •  Gipa
looks
like
MDA,
but
with
a
complete
different
 focus.
 VOOC
 2

  3. 3. Overview
 •  Integrity
in
domain
models
 •  Homeosta&c
or
self
regula&ng
approach
 •  PaDerns
of
integrity
preserving
associa&ons
 •  Specifying
associa&ons
 •  Code
genera&on
based
on
paDerns
and
 specifica&on
 •  Biology
inspired
object‐oriented
modeling
 environment
(Biome)
 VOOC
 3

  4. 4. The
problem:

 •  Objects
may
change
their
state
and

this
change
 may
influence
the
state
of
other
objects.
 •  The
state
of
objects
may
be
in
conflict
with
the
 state
of
other
objects.
 •  This
is
the
integrity
problem
 •  This
may
be
solved
using
with
self
regula&ng
or
 homeosta&c
algorithms.
 •  Development
of
homeosta&c
algorithms
is
&me
 consuming
and
requires
extensive
tes&ng.
 VOOC
 4

  5. 5. Integrity
of
object
structures
 •  Classical
ER
structure
 •  Classical
problem
but
not
solved
 •  Dangling
pointers‐dangling
objects
 •  Gipa
solu&on:
a
set
of
rules
that
can
be
 guarded
by
homeosta&c
methods.

 VOOC
 5

  6. 6. Integrity
in
domain
models
 •  3
types
of
domain
objects:
 –  Data
objects
(Integer,
Timestamp,
Class
etc)
 –  Structure
objects
(Collec&ons)
 –  Model
objects.
 VOOC
 6

  7. 7. 3
Rules
 •  Data
objects
should
never
be
changed.
 •  Structure
objects
should
be
kept
private.
 •  Naviga&on
between
model
objects
should
 always
be
bidirec&onal.
 VOOC
 7

  8. 8. Advantage
and
disadvantage
 •  Advantages
 –  The
domain
model
is
always
stable.
 –  There
are
a
number
of
paDerns
suppor&ng
the
 rules.
 •  Disadvantages
 –  Coding
is
a
more
complicated,
and
a
very
 repe&&ve
(boring)
task.
 VOOC
 8

  9. 9. Solu&on
 •  A
framework
for
genera&ng
paDern
based
 code.

 –  A
(domain)
model
specified
in
a
package
and
a
 namespace
 –  A
collec&on
of
domain
classes.
 –  A
collec&on
of
associa&ons.
 –  A
collec&on
of
roles
for
each
associa&on,
to
be
 implemented
by
a
set
of
classes.
 VOOC
 9

  10. 10. Associa&on
paDerns
 •  The
paDern
describes
the
associa&on
in
a
 parameterized
way.
 •  The
names
of
methods
and
variables
are
 stored
in
roles.
 •  Given
the
specifica&on
of
the
associa&on
in
 roles,
methods
and
variables
are
generated.
 VOOC
 10

  11. 11. Various
paDerns
 •  ToOne
(=
aDribute
access
in
the
VW
browser)
 •  ToMany
 •  OneToOne
 •  OneToMany
 •  ManyToMany
 •  DoubleLink
 •  Tree
 •  Any
paDern
anybody
wishes
to
implement
 VOOC
 11

  12. 12. Very
simple
example
 1  paDernToOneGet
 2  


|
stream
|
 3  


stream
:=
CodingStream
arguments:
self

args.
 4  


stream
nextPutAll:
‘{one,simple:s}
 5  







^{one,var:s}’.
 6  


^stream
selector
‐>(stream
code}
 VOOC
 12

  13. 13. Specifica&on
of
an
associa&on
 1  The
associa&on
paDern

 2  For
each
role
specified
by
the
associa&on
 paDern,
the
variable‐
and
method
name
 bases.
 3  XML
format:
GXD
(Gipa
XML
Defini&on)
 4  GXD
comparable
to
class
diagram
defini&on
 in
UML.
 VOOC
 13

  14. 14. Example
 •  <GipaModel
package="Gipa‐generated
oneToMany"
namespace="GIPAExample”>
 •  



<gipaClass
className="G_master_OneToMany">
 •  







<field
name="name"/>
 •  



</gipaClass>
 •  



<gipaClass
className="G_detail_OneToMany">
 •  







<field
name="name"/>
 •  



</gipaClass>
 •  



<gipaAssocia&on
defini&on="OneToMany">
 •  







<role
role="one"
variable="maten"
single="maat"
mul&ple="maten">
 •  











<class
className="G_master_OneToMany"/>
 •  







</role>
 •  







<role
role="many"
variable="master"
keySelector="name"
create="true">
 •  











<class
className="G_detail_OneToMany"/>
 •  







</role>
 •  



</gipaAssocia&on>




 •  </GipaModel>
 VOOC
 14

  15. 15. Generated
classes
and
methods
 VOOC
 15

  16. 16. Crucial
method
for
“many”

 1  master:
newMaster
 2  
 
 newMaster
=
master
ifTrue:[^newMaster].
 3  
 
 master
ifNotNil:
[:old
|
 4  
 
 
 master
:=
nil.
 5  
 
 
 old
removeMaat:
self].
 6  
 
 newMaster
ifNotNil:
[
 7  
 
 
 master
:=
newMaster.
 8  
 
 
 newMaster
addMaat:
self]
 VOOC
 16

  17. 17. Crucial
method
for
“one”
 1  addMaat:
newMaat
 2  
 |
result
|
 3  
 maten
ifNil:
[maten
:=
OrderedCollec&on
new].

 4  
 result
:=
maten
detect:
[:item
|
item
name
=
newMaat
name]
 5  
 ifNone:[ 

 6  
 
 maten
add:
newMaat.
 7  
 
 newMaat
master:
self.
 8  
 
 ^newMaat].
 9  
 result
==
newMaat
ifTrue:[^newMaat]
 10  
 
 ifFalse:[
 11  
 
 
 ^GipaDuplicateKeyExcep&on
raiseRequestWith:

 12  




























(Array
with:
result
with:
newMaat)
]
 VOOC
 17

  18. 18. Result
 •  A
class
diagram
can
be
specified
in
gxd
using
 an
xml
editor
like
oxygen
 •  This
generates
Smalltalk
code
10
&mes
larger.
 •  This
generated
code
is
already
tested.

 VOOC
 18

  19. 19. Work
to
do
 •  Gipa
is
part
of
a
larger
project:
Biome
 •  Biome:
Biology
Inspired
Object‐oriented
 Modelling
and
Engineering
 •  Structure
of
Biologic
science
can
be
used
as
a
 metaphore
for
agile
object‐oriented
 development
and
its
environment
 VOOC
 19

  20. 20. Mapping
Biologic
science
to
OO
 development
 Fundaments
 Cell
theory
 Object
theory
 Gene
theory
 Class
and
Role
 Persistence
 Research
areas
 Design
areas
 Physiology
 Processing,
Algorithms,
Unit
tes&ng
 Structure
 Object
structure,
class
diagram
 Taxonomy
 Inheritance
 Ecology
 Interac&on,
Associa&ons
 VOOC
 20

  21. 21. Mapping
II
 Force
and
Design
 Evolu&on
 Versions
 Forces
 Energy
 Efficiency
 Homeostasis
 Not
named,

 Oxen
used
in
stable
parts,
 Self
regula&ng
associa&ons.
 Homeostasis
 VOOC
 21

  22. 22. Focus
of
Biome
 •  Modelling
(Associa&ons
and
their
paDerns)
 •  Versioning
(Evolu&on
of
models)
 •  Persistancy

 •  IDE
 VOOC
 22

  23. 23. Focus
of
Biome
(modelling)
 •  Modelling
of
associa&ons
and
associa&on
 paDerns
 •  Implemen&ng
roles
by
classes
 •  S&mula&ng
homeostasis
to
make
associa&ons
 and
models
self
regula&ng
 VOOC
 23

  24. 24. Focus
of
Biome
(versioning)
 •  Current
versioning
VW
=
packages.
 •  A
Gipa
model
is
stored
in
package.
 •  Needed
granularity:
associa&ons
 •  Needed
version
associa&on:

 –  paDern
version‐>
associa&on
version
 •  Implemen&ng
an
associa&on
version
is
a
 transac&on
 VOOC
 24

  25. 25. Focus
of
Biome
(Persistancy)
 •  Associa&ons
and
roles
can
be
mapped
to
Gipa
 descrip&ons
in
GXD
 •  Suppor&ng
Glorp
using
GXD
 •  Suppor&ng
XML
marshalling
using
GXD
 VOOC
 25

  26. 26. Focus
of
Biome
(IDE)
 •  Suppor&ng
Associa&on‐Role
modelling
 •  Suppor&ng
Associa&on‐Role
paDern
modelling
 •  Suppor&ng
version
implementa&on
as
 transac&on
 •  Suppor&ng
upda&ng
associa&ons
as
a
result
of
 an
associa&on
paDern
upgrade
or
downgrade.
 VOOC
 26


×