Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

RMLL - Eclipse Acceleo Day - MDSD Scaffolding and Acceleo - Cédric Vidal - 1.1


Published on

Presentation on MDSD Scaffolding applied using EMF.Edit, a rule engine and Acceleo.

This talk was given at Eclipse Acceleo Day, on Friday 10th July 2009 during RMLL.

Published in: Technology
  • Be the first to comment

RMLL - Eclipse Acceleo Day - MDSD Scaffolding and Acceleo - Cédric Vidal - 1.1

  1. 1. MDSD<br />Scaffolding<br />and<br />Cédric Vidal, ProxiAD<br />Friday 10th July 2009<br />Version 1.0<br />
  2. 2. Who are we ?<br />ProxiADGroup<br />SSII specialized in objectorienteddevelopment<br />Dedicatedingenieringprocess industrialisation team<br />Using MDA since 2004 on J2EE projects<br />Cédric Vidal<br />J2EE & MDA Architect<br />ProxiAD IDF Technical Leader<br />
  3. 3. Agenda<br />WhatisScaffolding ?<br />Scaffolding in software<br />Scaffoldingapplied to MDSD<br />MDSD Scaffoldingapproaches<br />Acceleo MTL<br />Demo<br />Benefits<br />Links<br />
  4. 4. Whatisscaffolding ?<br />Scaffolds are temporary structures that physically support workers while they complete jobs that would otherwise be impossible(HH93, p138)<br />
  5. 5. Scaffolding in software<br />Ruby on Rails<br />*Rails scriptingframeworksbringblazingfastproductivity in theirownspecifictechnologicalspace<br />MainlythroughScaffolding !<br />
  6. 6. Ruby on Rails Scaffolding<br />Meta-Programming<br />Scaffoldingworksat the code level<br />Scaffoldingengineoperates on code as a model<br />Can beeither<br />Static : on demand<br />Dynamic : transparently on yourbehalf<br />Entity.rb<br />DAO.rb<br />
  7. 7. Others<br />Ruby On Rails<br />Grails<br />Spring ROO<br />Play!<br />CakePHP<br />Monorail<br />Symfony<br />…<br />
  8. 8. What’s the point ?<br />Model-Drivenbringsquality, durability, maintainability<br />What about productivity ?<br />Code generationtemplateswritingalready productive withAcceleo (old and MTL)<br />Goal: Enhancemodelingproductivity<br />
  9. 9. Objective<br />Achievebothquality AND productivity<br />BringScaffolding to Modeling<br />
  10. 10. WhatisScaffoldingapplied to Modeling ?<br />Creating partial model structures on behalf of the designer that hewouldotherwise have to create by himself<br />
  11. 11. Model Scaffoldingtaxonomy<br />Blind versus In-PlaceScaffolding<br />Static versus DynamicScaffolding<br />The greener the better<br />
  12. 12. Model Scaffoldingtaxonomy<br />Classical code generation<br />Compensated code generation<br />« Blind » scaffolding<br />« In-Place » scaffolding<br />Eachstatic or dynamic<br />
  13. 13. Sampleproblemdomain<br />3-Tiers Architecture<br />DSL containing concepts<br />Entity<br />DAO<br />Service<br />Java code isgenerated<br />Légende<br />Entity or DAO<br />File<br />Service<br />Generation<br />Reference<br />Model separation<br />Color code<br />Hand-written<br />Scaffolded<br />Generated<br />
  14. 14. Classical code generation 1/2<br />Entities are modeled<br />Entity and DAO source codes are generatedfrom the modeledEntity<br />Problem: What if youwant to definequeries in your model ?<br />Model<br />Entity<br />Text<br /><br /><br />
  15. 15. Classical code generation 2/2<br />Entity and DAOs are modeled<br />Entity source code isgeneratedfrom the modeledEntity<br />DAO source code isgeneratedfrommodeled DAO<br />DAOswhich are not modeled are not generated<br />Problem: You need to define all DAOs…<br />Eventhosethatonly do CRUD<br />Model<br />DAO<br />Entity<br />Text<br /><br /><br />
  16. 16. Compensated code generation<br />Source code isstillgeneratedfor modeledelements<br />For Entitieswhich have no modeled DAO, wecompensate by generatingsource code for the DAO from the modeledEntity<br />Advantage: Only custom DAOs are modeled<br />Problem: DAO code generationlogicisduplicated<br />Entity -&gt;<br />DAO -&gt;<br />Model<br />Entity<br />One<br />DAO<br />One<br />Entity<br />Two<br /><br /><br /><br /><br />Text<br />
  17. 17. Generation « Blind » Model Scaffolding<br />Model i<br />Entity<br />Two<br />Each model is a step in the MDSD chain<br />An intermediatestepisintroduced<br />Each model canonly « see » the model before<br />Existingelements are copied as is<br />A DAO isgenerated for eachentitywhich has no DAO<br />Advantage: Only one DAO code generationlogic<br />Problem: How do youreferencescaffoldedelements<br />DAO<br />TwoDao<br />Entity<br />One<br />Model i-bis<br />Entity<br />Two<br />DAO<br />TwoDao<br />Entity<br />One<br />DAO<br />OneDao<br />Model i+1<br /><br /><br /><br /><br />
  18. 18. How to referencescaffoldedelements ?<br />The problemisillustrated by introducing a service<br />The ‘Alpha’ service canreference the modeled DAO ‘TwoDao’ but not the scaffolded DAO ‘OneDao’<br />The scaffolded DAO ‘OneDao’ islocated in a model that the ‘Alpha’ service cannotsee<br />Problem: « Blind » scaffoldingdoesn’tallowscaffoldedelementsreferencing<br />Modèle i<br />DAO<br />TwoDao<br />Entity<br />Two<br />Entity<br />One<br />Service<br />Alpha<br />Modèle i-bis<br />DAO<br />OneDao<br />Entity<br />One<br />
  19. 19. « In-place » Model Scaffolding<br />‘OneDao’ DAO isscaffolded in the same model as Entity ‘One’<br />The DAO is « visible » withoutbeingmaterialized in the input model<br />Advantage: Le ‘Alpha’ service canreference the scaffolded DAO ‘OneDao’<br />Problem: How to customize a scaffoldedelement ?<br />Model i<br />Entity<br />One<br />DAO<br />OneDao<br />Service<br />Alpha<br />Model i+1<br /><br /><br /><br />
  20. 20. Takeover 1/3: Overview<br />User cantake over scaffoldedelements<br />The over takenelementisthenmaterialized in the input model<br />Advantage: The DAO canbecustomized<br />Iteration n<br />Entity<br />One<br />DAO<br />OneDao<br />Service<br />Alpha<br />Iteration n+1<br />Entity<br />One<br />DAO<br />OneDao<br />Service<br />Alpha<br />
  21. 21. Takeover 2/3: Zoom<br />After the DAO taking over, CRUD methods are stillscaffolded<br />Advantage: No need to manually input previouslyscaffoldedelements<br />DAO<br />OneDao<br />Iteration n<br />Entity<br />One<br />Service<br />Alpha<br />create<br />read<br />update<br />delete<br />Iteration n+1<br />DAO<br />OneDao<br />Entity<br />One<br />Service<br />Alpha<br />create<br />read<br />update<br />delete<br />
  22. 22. Takeover 3/3: Customisation<br />Iteration n+1<br />Let’sadd a finderfinder<br />CRUD methods are stillscaffolded<br />Advantage: Onlycustomizations are hand written, CRUD methods are scaffolded<br />DAO<br />OneDao<br />Entity<br />One<br />Service<br />Alpha<br />create<br />read<br />update<br />delete<br />Iteration n+2<br />DAO<br />OneDao<br />Entity<br />One<br />Service<br />Alpha<br />create<br />read<br />update<br />delete<br />myFinder<br />
  23. 23. Deletion 1/2: The problem<br />Whathappens if the user deletes an element for whichelementswerescaffolded ?<br />Scaffoldedelements must alsobedeleted<br />Model i<br />Entity<br />One<br />DAO<br />OneDao<br />Service<br />Alpha<br />Model i+1<br /><br /><br /><br />
  24. 24. Deletion 2/2: solutions<br />Need to keeptrackof scaffoldedelements<br />Onlyreally a problemwithdynamic « in-place » scaffolding<br />For static and/or « blind » scaffolding, scaffoldedelementscanjustbecomputed all over again<br />
  25. 25. Model scaffoldingcomparison<br />
  26. 26. WhatScaffoldingengine ?<br />A model to model transformation engine ?<br />ATL<br />Xtend<br />QVT Operational<br />QVT Relational<br />Obeo Transfo<br />…<br />A ruleengine ?<br />Drools<br />Any OO RuleEngine …<br />
  27. 27. A ruleengine ??<br />Scaffoldingrules as production rules<br />The model as a workingmemory<br />Model elements as facts<br />When a givenconditionis met, new factsare insertedintoworkingmemory<br />Those new facts are attached to the model as new elements<br />
  28. 28. Ruleenginesyncprocess<br />Working Memory<br />Model<br />Entity<br />One<br />synchronize<br />Entity<br />One<br />reference<br />ScaffoldingRule<br />reference<br />DAO<br />OneDao<br />DAO<br />OneDao<br />synchronize<br />
  29. 29. Droolssamplerule<br />SampleDrools DAO scaffoldingrule<br />
  30. 30. Pros and cons<br />M2M Engine<br />Pros<br />Leveragesexistingskills<br />Sametechnologicalspace<br />Suited for staticscaffolding<br />Cons<br />Hard to use for dynamic « in-place » scaffolding<br />RuleEngine<br />Pros<br />Nativelysuited for dynamic « in-place » scaffolding<br />Can do staticscaffolding as well<br />Cons<br />Differenttechnologicalspace as the rest of the MDSD technologies<br />Cannotleverageexistingskills and transformations<br />
  31. 31. Scaffoldingdemo<br />Dynamic « In-Place » DSL Scaffoldingdemo<br />Uses<br />A DSL withEntity, DAO and Service concepts<br />An EMF.Edit editor<br />DroolsRuleEngine as the scaffoldingengine<br />
  32. 32. MDSD Scaffoldingbenefits<br />Acceleratesmodeling<br />Allows to quickly come up with a working model<br />The user startsfrom the beginingwith a complete model (complete in the direction the scaffoldingtakeshim)<br />Provides the user with a fastfeedback<br />Allows to enrich the input model as well as facilitatingits usage for the new user<br />Bringsflexibilitywhilekeepingsimplicity<br />Scaffoldingcanbecomplemented by code generationand model validation<br />The user canwheneverhewantstake over the scaffoldedelements in order to customizethem<br />
  33. 33. Otherintegrations<br />Structured model editors<br />EMF.Edit<br />GraphicalDSLs<br />GMF<br />Obeo Designer<br />TextualDSLs<br />Xtext<br />UML models<br />Papyrus/UML2Tools/Topcased<br />IBM RSM<br />
  34. 34. Links<br />JBossDrools<br />Eclipse Acceleo MTL<br />ProxiAD’s Blog<br />Cédric Vidal’s Blog<br />Cédric Vidal’sTwitter<br />
  35. 35. References<br />HH93 - Herber, H., & Herber, J. (1993). Teaching in Content Areas With Reading, Writing, and Reasoning. Allyn & Bacon: Needham Heights, M.A.<br />