Introducing MDSD

  • 3,535 views
Uploaded on

Introducing Model Driven Software Development. Session for Code Generation 2011

Introducing Model Driven Software Development. Session for Code Generation 2011

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
3,535
On Slideshare
0
From Embeds
0
Number of Embeds
6

Actions

Shares
Downloads
0
Comments
2
Likes
7

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Introducing Model Driven Software Development Pedro J. Molina, PhD. Software Engineer Capgemini Spain | Valencia pjmolina@gmail.com http://pjmolina.com/metalevel
  • 2. Contents Objective What’s MDSD? Why are we doing it? How we can apply it? CG2011 Program review 2
  • 3. Setting expectations  What to expect from CG2011?  The Europe leading conf. about Code Generation  Focused on practical tools and industrial experiences  A place to find and discuss with the Tool Makers  Probably one of the best places to 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 3
  • 4. Motivation: 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 developped 3. No way to cope with it 4. End User Programming  Example: Visical, Excel  By DSL, abstraction  Custom languages http://mymodelingblog.blogspot.com/2009/08/impossible-equation.html 4
  • 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 / SpecsSemantic Gap 4GL Abstraction level COBOL / C / Basic / Java Assembler Machine Code 5
  • 6. What’s a Domain? Real Time Management Systems Systems Air Traffic Luggage Insurance Control Tracking Systems Systems Systems Focused on strict time  Focused on structure, data constrains and tracking and transactions 6
  • 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 Assignclass Invoice: Document Record Cost min.{  public void Bill() Duration Imperative Call DB 7
  • 8. What’s 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 * 8
  • 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 9
  • 10. MDD Model Driven Development Definition: The usage of Models as the main artefacts to Drive the software Development. 10
  • 11. Code Generation Model Code Assets GeneratorDefinition:The automated synthesis of SW assets likesource code, documentation or models usingmodels as input. 11
  • 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 12
  • 13. Commonality / Variability Family of programs (D. Parnas)  Common part  Standard, Fixed.  Implementable in common & shared base libraries  Variable part  Specify in the model  Generable 13
  • 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. 14
  • 15. ROI Economies of Scale Economies of Scope Economics of MDSD Development Life Cycle Impact Quality 15
  • 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. 16
  • 17. 17
  • 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] 18
  • 19. MDSD: Economic Model Investment Domain Engineering Feedback:  Clients suggestionsApplication Development  Improvements for the Environment development environment Application Engineering ROI (development cost saving) Applications 19
  • 20. MDSD: Economic Model Traditional Cost = N * CT MDD cost = Inv + N * CF Saving AF = CT - CF 5 CT 4 CTAccumulated costs 3 CT 2 CT Inv CT 1 2 3 4 5 Family members 20
  • 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 21
  • 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 22
  • 23. Models: some Cases of Use1. Validation 2. Interpretation 3. Code Generation Model Model Model Model Code Interpreter Checker Generation Runtime Code interpretation Metadata Generated Doc Report Code Config. Tests ... 23
  • 24. Conceptual Map for Code GenerationTypes Metamodel Templates Transformations Code GeneratorInstances Model Code Higher Abstraction Level Lower 24
  • 25. 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 25
  • 26. Code Generation with UML toolsTypes Metamodel Templates TransformationsInstances Model Code Higher Abstraction Level Lower 26
  • 27. 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) 27
  • 28. 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 28
  • 29. DSL A DSL approach to MDSD gives 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 29
  • 30. 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; 30
  • 31. Code Generation with EMFTypes EMF Metamodel Templates TransformationsInstances EMF Model Code Higher Abstraction Level Lower 31
  • 32. Code Generation with MS DSL ToolsTypes DSL Metamodel T4 Templates TransformationsInstances DSL Model Code Higher Abstraction Level Lower 32
  • 33. Code generation techniques1. Parse model Input Model2. In-memory representation Template  AST / Object Model AST3. Output building  Free text concatenation  XSL-T (ouch!)  Text Template based Output code 33
  • 34. Tools matters Metamodel(s) ReverseTextual Model Editor Engineering ToolsVisual Model Editor Model(s) Model Checker IDE Model Transformation M2M M2T Code Model Doc, etc. 34
  • 35. Who are working in the area? Eclipse EMF/GMF  Microsoft  IBM  DSL Tools  SAP  MetaCase  Obeo  MetaEdit+ Xtext  JetBrains  Itemis  MPS  Intentional Software xUML / MDA  Intentional Workbench  Kennedy Carter  Blue Age  WebRatio  Artisan  Mendix  AndroMDA  Many more  Olivanova  … Presenting at CG2011 or LWC2011 35
  • 36. Language Workbenches Competition 2011 Tool Presenter MPS Markus Völter MetaEdit+ Steven Kelly OOMEGA Christian Merenda Whole Platform Riccardo Solmi Rascal Jurgen Vinju Spoofax Lennart Kats Intentional Mats Helander Essential Pedro J. Molina Obeo Designer Mariot Chauvin Xtext Karsten Thoms Session Chair: Angelo HulshoutLanguage Workbench: http://martinfowler.com/articles/languageWorkbench.html [Fowler2005] 36
  • 37. Programme Guide Keynotes  Terence Parr  ANTLR  StringTemplate Thursday 26th 9:00 H  Ed Merks  Eclipse Modeling Framework leader Friday 27th 9:00 H 37
  • 38. Programme Guide  Experience reports  Lesson from real MDSD applications  Tool tutorials and Hand on Labs  Learn to use them  Panels and Goldfish bowl  Promote debate and participation about a reference topic  Birds of a Feather  Formation of informal interest groups on the fly 38
  • 39. CG2011 Tips Choose your path  Parallel tracks  Split your team  Check for slides of missing session on the conference web, SlideShare or InfoQ.com Interact!  Tweet about it using the tag #cg2011  Install the CG2011 iPhone App  Introduce yourself and involve in the community  Ask whenever something is not clear to you  Ask for each dark acronym you find  Do not miss the traditional and relaxing punting trip!  Continue the discussion on the social network: http://modeldrivensoftware.net/ 39
  • 40. Conclusions A change in SW development is needed MDSD :  Provide leverage points to reach new levels of productivity  Offer a clear path to make better engineering in Computer Science 40
  • 41. Thank you!Questions? @pmolinam