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

GIPA

  • Upload
    esug

  • View
    1.196

  • Download
    1

Embed Size (px)

DESCRIPTION

GIPA by Reinier van Oosten, ESUG09, Brest, France

Citation preview

Page 1: GIPA

Genera&ngIntegrityPreservingAssocia&ons,

TheFirststeptoBiome

ReiniervanOostenVOOC

1VOOC

Page 2: GIPA

WhatisGipa

•  Gipaisasetofparameterizedimplementa&onlevelpaDernclasses.

•  Thesecanbeusedtogeneratemethodsandvariablesindomainmodelclasses.

•  ThepaDernsdescribeatypeofassocia&onandtheircomposingroles.

•  ThecurrentfocusofGipaisonstructureassocia&onslike1tonrela&onship.

•  ThefocusofGipaisonintegritypreserva&on.•  GipalookslikeMDA,butwithacompletedifferentfocus.

VOOC 2

Page 3: GIPA

Overview

•  Integrityindomainmodels•  Homeosta&corselfregula&ngapproach

•  PaDernsofintegritypreservingassocia&ons•  Specifyingassocia&ons•  Codegenera&onbasedonpaDernsandspecifica&on

•  Biologyinspiredobject‐orientedmodelingenvironment(Biome)

3VOOC

Page 4: GIPA

Theproblem:

•  Objectsmaychangetheirstateandthischangemayinfluencethestateofotherobjects.

•  Thestateofobjectsmaybeinconflictwiththestateofotherobjects.

•  Thisistheintegrityproblem•  Thismaybesolvedusingwithselfregula&ngorhomeosta&calgorithms.

•  Developmentofhomeosta&calgorithmsis&meconsumingandrequiresextensivetes&ng.

4VOOC

Page 5: GIPA

Integrityofobjectstructures

•  ClassicalERstructure•  Classicalproblembutnotsolved

•  Danglingpointers‐danglingobjects

•  Gipasolu&on:asetofrulesthatcanbeguardedbyhomeosta&cmethods.

5VOOC

Page 6: GIPA

Integrityindomainmodels

•  3typesofdomainobjects:– Dataobjects(Integer,Timestamp,Classetc)

– Structureobjects(Collec&ons)– Modelobjects.

6VOOC

Page 7: GIPA

3Rules

•  Dataobjectsshouldneverbechanged.•  Structureobjectsshouldbekeptprivate.•  Naviga&onbetweenmodelobjectsshouldalwaysbebidirec&onal.

7VOOC

Page 8: GIPA

Advantageanddisadvantage

•  Advantages– Thedomainmodelisalwaysstable.

– ThereareanumberofpaDernssuppor&ngtherules.

•  Disadvantages– Codingisamorecomplicated,andaveryrepe&&ve(boring)task.

8VOOC

Page 9: GIPA

Solu&on

•  Aframeworkforgenera&ngpaDernbasedcode.– A(domain)modelspecifiedinapackageandanamespace

– Acollec&onofdomainclasses.– Acollec&onofassocia&ons.– Acollec&onofrolesforeachassocia&on,tobeimplementedbyasetofclasses.

9VOOC

Page 10: GIPA

Associa&onpaDerns

•  ThepaDerndescribestheassocia&oninaparameterizedway.

•  Thenamesofmethodsandvariablesarestoredinroles.

•  Giventhespecifica&onoftheassocia&oninroles,methodsandvariablesaregenerated.

10VOOC

Page 11: GIPA

VariouspaDerns

•  ToOne(=aDributeaccessintheVWbrowser)•  ToMany•  OneToOne•  OneToMany•  ManyToMany•  DoubleLink•  Tree

•  AnypaDernanybodywishestoimplement

11VOOC

Page 12: GIPA

Verysimpleexample

1  paDernToOneGet

2  |stream|3  stream:=CodingStreamarguments:selfargs.

4  streamnextPutAll:‘{one,simple:s}5  ^{one,var:s}’.

6  ^streamselector‐>(streamcode}

VOOC 12

Page 13: GIPA

Specifica&onofanassocia&on

1  Theassocia&onpaDern2  Foreachrolespecifiedbytheassocia&on

paDern,thevariable‐andmethodnamebases.

3  XMLformat:GXD(GipaXMLDefini&on)

4  GXDcomparabletoclassdiagramdefini&oninUML.

13VOOC

Page 14: GIPA

Example•  <GipaModelpackage="Gipa‐generatedoneToMany"namespace="GIPAExample”>

•  <gipaClassclassName="G_master_OneToMany">•  <fieldname="name"/>•  </gipaClass>

•  <gipaClassclassName="G_detail_OneToMany">•  <fieldname="name"/>•  </gipaClass>

•  <gipaAssocia&ondefini&on="OneToMany">•  <rolerole="one"variable="maten"single="maat"mul&ple="maten">•  <classclassName="G_master_OneToMany"/>•  </role>•  <rolerole="many"variable="master"keySelector="name"create="true">•  <classclassName="G_detail_OneToMany"/>•  </role>•  </gipaAssocia&on>•  </GipaModel>

14VOOC

Page 15: GIPA

Generatedclassesandmethods

15VOOC

Page 16: GIPA

Crucialmethodfor“many”

1  master:newMaster

2  newMaster=masterifTrue:[^newMaster].

3  masterifNotNil:[:old|

4  master:=nil.

5  oldremoveMaat:self].

6  newMasterifNotNil:[

7  master:=newMaster.

8  newMasteraddMaat:self]

16VOOC

Page 17: GIPA

Crucialmethodfor“one”1  addMaat:newMaat2  |result|3  matenifNil:[maten:=OrderedCollec&onnew].4  result:=matendetect:[:item|itemname=newMaatname]5  ifNone:[ 6  matenadd:newMaat.7  newMaatmaster:self.8  ^newMaat].9  result==newMaatifTrue:[^newMaat]10  ifFalse:[11  ^GipaDuplicateKeyExcep&onraiseRequestWith:12  (Arraywith:resultwith:newMaat)]

17VOOC

Page 18: GIPA

Result

•  Aclassdiagramcanbespecifiedingxdusinganxmleditorlikeoxygen

•  ThisgeneratesSmalltalkcode10&meslarger.

•  Thisgeneratedcodeisalreadytested.

18VOOC

Page 19: GIPA

Worktodo

•  Gipaispartofalargerproject:Biome•  Biome:BiologyInspiredObject‐orientedModellingandEngineering

•  StructureofBiologicsciencecanbeusedasametaphoreforagileobject‐orienteddevelopmentanditsenvironment

19VOOC

Page 20: GIPA

MappingBiologicsciencetoOOdevelopment

Fundaments

Celltheory Objecttheory

Genetheory ClassandRolePersistence

Researchareas Designareas

Physiology Processing,Algorithms,Unittes&ng

Structure Objectstructure,classdiagram

Taxonomy Inheritance

Ecology Interac&on,Associa&ons

20VOOC

Page 21: GIPA

MappingII

ForceandDesign

Evolu&on Versions

Forces

Energy Efficiency

Homeostasis Notnamed,Oxenusedinstableparts,Selfregula&ngassocia&ons.

Homeostasis

21VOOC

Page 22: GIPA

FocusofBiome

•  Modelling(Associa&onsandtheirpaDerns)•  Versioning(Evolu&onofmodels)

•  Persistancy•  IDE

22VOOC

Page 23: GIPA

FocusofBiome(modelling)

•  Modellingofassocia&onsandassocia&onpaDerns

•  Implemen&ngrolesbyclasses

•  S&mula&nghomeostasistomakeassocia&onsandmodelsselfregula&ng

23VOOC

Page 24: GIPA

FocusofBiome(versioning)

•  CurrentversioningVW=packages.•  AGipamodelisstoredinpackage.

•  Neededgranularity:associa&ons•  Neededversionassocia&on:– paDernversion‐>associa&onversion

•  Implemen&nganassocia&onversionisatransac&on

24VOOC

Page 25: GIPA

FocusofBiome(Persistancy)

•  Associa&onsandrolescanbemappedtoGipadescrip&onsinGXD

•  Suppor&ngGlorpusingGXD•  Suppor&ngXMLmarshallingusingGXD

25VOOC

Page 26: GIPA

FocusofBiome(IDE)

•  Suppor&ngAssocia&on‐Rolemodelling•  Suppor&ngAssocia&on‐RolepaDernmodelling

•  Suppor&ngversionimplementa&onastransac&on

•  Suppor&ngupda&ngassocia&onsasaresultofanassocia&onpaDernupgradeordowngrade.

26VOOC