CG2010 Introducing MDSD


Published on

Introduction to Model Driven Software Development. Code Generation 2010. Cambridge, UK June 16th.

Published in: Technology
1 Comment
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

CG2010 Introducing MDSD

  1. 1. Introducing Model-Driven Software Development Pedro J. Molina, PhD. Software Engineer Capgemini Spain | Valencia
  2. 2. Contents Objective What’s MDSD? Why are we doing it? How we can apply it? CG2010 Program review Advices © MMX Pedro J. Molina, PhD. 2
  3. 3. Objective What to expect from CG2010? The Europe leading conf. about Code Generation Focused in practical tools and industrial experiences A place to find and discuss with the Tool Makers Probably one of the best places for learn and share knowledge about Code Generation My objective with this session Provide an overview to Code Generation Provide clues to newcomers to select your own path in the conference © MMX Pedro J. Molina, PhD. 3
  4. 4. Professional programmers needed! The impossible equation (Jean Bézivin) 1. Slow increase of professionals Same trend in next 25 years 2. Rapid increase of SW to be developed 3. No way to cope with it 4. End User Programming Example: Visical, Excel By DSL, abstraction Custom languages © MMX Pedro J. Molina, PhD. 4
  5. 5. Abstraction Levels The entire history of software engineering is Application one of rising levels of abstraction (abstraction Domain is the primary way we as humans deal with complexity). Grady Booch Models / Specs Semantic Gap 4GL Abstraction level COBOL / C / Basic / Java Assembler Machine Code © MMX Pedro J. Molina, PhD. 5
  6. 6. What’s a Domain? Real Time Management Systems Systems Air Traffic Luggage Insurance Control Tracking Systems Systems Systems Focused in strict time Focused in structure, data constrains and tracking and transactions © MMX Pedro J. Molina, PhD. 6
  7. 7. What’s a Language? Declarative ∂C(x) ∂ h2 2C(x) ih = – ∂t 2m ∂ x2 a>b && c==d John cookies 24 green Phil fish 32 blue <CallRecord> <caller><number>07713248</number> Textual Employee Name Position Description Graphical Address 0..* Salary Promote Assign class Invoice: Document Record Cost min. { × public void Bill() Duration Imperative Call DB © MMX Pedro J. Molina, PhD. 7
  8. 8. What is a model? A model allows the description of a family of problems for a domain Having the abstraction level carefully selected to: Discard irrelevant details (reduce complexity) Source Discard constant details (reduce complexity) Explicit important details (variables part) Class Relation Properties Cardinality What’s a meta-model? Target A model describing model. Customer Credit Card 1 * © MMX Pedro J. Molina, PhD. 8
  9. 9. Some Acronyms MD* (MDD = MDE = MDSD ⊃ MDA) MDSD MDSD = Model-Driven Software Development MDA DSLs MDD = Model Driven Development MDE = Model Driven Engineering MDA = Model Driven Architecture OMG = Object Management Group DSL = Domain Specific Language AST = Abstract Syntactic Tree © MMX Pedro J. Molina, PhD. 9
  10. 10. MDD Model Driven Development Definition: The usage of Models as the main artefacts to Drive the software Development. © MMX Pedro J. Molina, PhD. 10
  11. 11. Code Generation Model Code Assets Generator Definition: The automated synthesis of SW assets like source code, documentation or models using models as input. © MMX Pedro J. Molina, PhD. 11
  12. 12. Novak’s rule “Automatic Programming is defined as the synthesis of a program from an specification. If automatic programming is to be useful, the specification must be smaller and easier to write than the program would be if written in a conventional programming language.” G.S. Novak © MMX Pedro J. Molina, PhD. 12
  13. 13. Commonality / Variability Family of programs (D. Parnas) Common part Standard, Fixed. Implementable in common & shared base libraries Variable part Specify in the model Can be generated © MMX Pedro J. Molina, PhD. 13
  14. 14. Separation of Concerns (SoC) Know-How captured in two separated buckets: What How Business Know-How: Technological Know-How: captured in form of models captured & encapsulated in form of (specifications): isolated from best practices, frameworks, technological issues templates & code patterns in code generators & interpreters. © MMX Pedro J. Molina, PhD. 14
  15. 15. ROI Economies of Scale Economies of Scope Economics of MDSD Development Life Cycle Impact Quality © MMX Pedro J. Molina, PhD. 15
  16. 16. Economies of Scale Economies of Scale The condition where few inputs, as effort and time, are needed to produce big quantities of a unique output. [Wit96] But: Can’t be applied to SW! Once the SW is produced Copy cost is = 0 £! Japanese Cookie Factory. Production Line. © MMX Pedro J. Molina, PhD. 16
  17. 17. © MMX Pedro J. Molina, PhD. 17
  18. 18. Economies of Scope Economies of Scope The condition where few inputs, as effort and time, are needed to produce a great variety of outputs. It is produced more added value producing in the same line different outputs. To produce each output independently creates an overcost in the common parts. Economy of Scope occurs when the cost of combining two or more products in a unique product line is lower than producing them independently. [Wit96] © MMX Pedro J. Molina, PhD. 18
  19. 19. MDSD: Economic Model Investment Domain Engineering Feedback: Clients suggestions Application Development Improvements for the Environment development environment Application Engineering Applications ROI (development cost saving) © MMX Pedro J. Molina, PhD. 19
  20. 20. MDSD: Economic Model Traditional Cost = N * CT MDD cost = Inv + N * CF Saving AF = CT - CF 5 CT 4 CT Accumulated costs 3 CT 2 CT Inv CT 1 2 3 4 5 Family members © MMX Pedro J. Molina, PhD. 20
  21. 21. SW Life cycle Impact More time in analysis and design tasks Less time in coding Less defect, more Quality Improved productivity Order of magnitude Continuous Integration Agile development cycles Less cost © MMX Pedro J. Molina, PhD. 21
  22. 22. Defects Cost and Distribution Traditional life cycle MDD life cycle Exponential cost % Defects 8€ of defects 4€ 2€ 1€ Analysis Design Coding Maintenance Snow ball effect © MMX Pedro J. Molina, PhD. 22
  23. 23. Models: some Cases of Use 1. Validation 2. Interpretation 3. Code Generation Model Model Model Model Code Interpreter Checker Generation Runtime Code interpretation Metadata Generated Doc Report Code Config. Tests ... © MMX Pedro J. Molina, PhD. 23
  24. 24. Conceptual Map for Code Generation Types Metamodel Templates Transformations Code Generator Instances Model Code Higher Abstraction Level Lower © MMX Pedro J. Molina, PhD. 24
  25. 25. Code Generation: Demo Types Metamodel Templates Transformations Code Generator Instances Model Code Higher Abstraction Level Lower © MMX Pedro J. Molina, PhD. 25
  26. 26. UML/MDA UML: Unified Modelling Language Origins: unified notation (from three sources, The Three Amigos) OCL: constraint language Great acceptation, common language for software engineering MDA: Model Driven Architecture MDA = MDSD with UML Proposed by OMG Profiles PIM/PSM MOF/XMI © MMX Pedro J. Molina, PhD. 26
  27. 27. Code Generation with UML tools Types Metamodel Templates Transformations Instances Model Code Higher Abstraction Level Lower © MMX Pedro J. Molina, PhD. 27
  28. 28. Code Generation with UML/MDA Usage of UML Models Extension mechanism: «persistent» Customer Stereotypes Profiles for specialized domains «pk» string Id «derived» double Balance Good enough for: Structure: class and properties State transition diagrams (frequent in embedded systems) © MMX Pedro J. Molina, PhD. 28
  29. 29. Code Generation with UML/MDA As rich/poor enough as you can express and maintain in UML “Only a 20% of UML is generally needed for SW development.” Ivar Jacobson But: What percent of my problem can such 20% of UML solve? Metamodel is highly closed Only extensible at certain points Shortcomings Symbol and concept overloading Not clear Semantics Action Language Domains not cover by UML: e.g. User Interfaces Abuse of profiles Forces models and semantics (One size doesn’t fit all) Tools: many dialects of XMI Babel’s Tower © MMX Pedro J. Molina, PhD. 29
  30. 30. DSL A DSL approach to MDSD give you full control on the development of your metamodel Powerful Better well suited to your needs Do it yourself approach Tools to be built Metamodels, editors, model checkers, compilers, code generators © MMX Pedro J. Molina, PhD. 30
  31. 31. DSL Internal DSL: Sample LINQ var studentPassList = from student in students where student.Score > 500 select student; External DSL: Sample SQL SELECT Name, Surname FROM STUDENT WHERE Score > 500; © MMX Pedro J. Molina, PhD. 31
  32. 32. Code Generation with EMF Types EMF Metamodel Templates Transformations Instances EMF Model Code Higher Abstraction Level Lower © MMX Pedro J. Molina, PhD. 32
  33. 33. Code Generation with MS DSL Tools Types DSL Metamodel T4 Templates Transformations Instances DSL Model Code Higher Abstraction Level Lower © MMX Pedro J. Molina, PhD. 33
  34. 34. Code generation techniques 1. Parse model Input Model 2. In-memory representation Template AST / Object Model AST 3. Output building Free text concatenation XSL-T (ouch!) Text Template based Output code © MMX Pedro J. Molina, PhD. 34
  35. 35. Tools matters Metamodel(s) Reverse Textual Model Editor Engineering Tools Visual Model Editor Model(s) Model Checker IDE Model Transformation M2M M2T Code Model Doc, etc. © MMX Pedro J. Molina, PhD. 35
  36. 36. Who are working in the area? Eclipse EMF/GMF Microsoft IBM DSL Tools OSLO (rebranded to Microsoft SAP SQL Server Modeling) OpenArchitectureware MetaCase XText MetaEdit+ Itemis Language workbenches Jetbrains MPS xUML / MDA Spoofax Kennedy Carter Intentional Workbench Blue Age Artisan Code Fluent AndroMDA Many more Olivanova Model Execution … Presenting at CG2010 © MMX Pedro J. Molina, PhD. 36
  37. 37. Programme Review Experience reports Lesson from real MDSD applications Tool tutorials and Hand on Labs Learn to use them Panels and Think Tanks Promote debate and participation about a reference topic Birds of a Feather Informal interest groups on the fly © MMX Pedro J. Molina, PhD. 37
  38. 38. CG2010 Advices Choose your path Parallel tracks Split your team Check for slides of missing session on the conference web Interact! Ask whenever something is not clear to you Ask for each dark acronym you found Introduce yourself and involve in the community Do not miss the punting trip! Continue the discussion on the community site: © MMX Pedro J. Molina, PhD. 38
  39. 39. Conclusions A change in SW development it is needed MDSD can: Provide leverage points to reach new levels of productivity Offer a clear path for making real engineering in Computer Science © MMX Pedro J. Molina, PhD. 39
  40. 40. Thank you! Questions? © MMX Pedro J. Molina, PhD. 40