IN4308 1

1,254 views

Published on

Introduction lecture for course on Model-Driven Software Development at Delft University of Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,254
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
33
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

IN4308 1

  1. 1. Model-Driven Software Development Lecture1: Introduction & Overview Course IN4308 Eelco Visser Master Computer Sciencehttp://eelcovisser.org Delft University of Technology
  2. 2. Source: Automatiseringsgids January 16, 2010 “Generator spits out ‘mobile’ applications”“Steape has developed a code generator that automatically generates code for a range of mobile phones”
  3. 3. Software Engineering implementProblem SolutionDomain Domain validate
  4. 4. Programming Languages
  5. 5. Programming Languages"A programming language is low level when its programs require attention to the irrelevant." Alan J. Perlis. Epigrams on Programming. SIGPLAN Notices, 17(9):7-13, 1982.
  6. 6. Machine Language to Assembly LanguageProgram I-I. Disassembly.., 0360 A9 01    LDA #$01., 0362 A0 00    LDY #$00 “Lets examine some advantages., 0364 99 00 80 STA $8000,Y of ML, starting with the main., 0367 99 00 81 STA $8100,Y one - ML runs extremely fast.”., 036A 99 00 82 STA $8200,Y., 036D 99 00 83 STA $8300,Y., 0370 C8       INY., 0371 D0 F1    BNE $0364., 0373 60       RTS.    Machine Language        169 1 160 0 153 0 128 153 0 129 153 130 153 0 131 200 208 241 96    BASIC        5 FOR I=1 TO 1000: PRINT "A";: NEXT I Source: http://www.atariarchives.org/mlb/introduction.php
  7. 7. From Instructions to Expressions mov &a, &c c = a add &b, &c c += b mov &a, &t1 t1 = a sub &b, &t1 t1 -= b and &t1,&c c &= t1 c = (a + b) & (a - b)Source: http://sites.google.com/site/arch1utep/home/course_outline/translating-complex-expressions-into-assembly-language-using-expression-trees
  8. 8. From Calling Conventions to Procedurescalc: push eBP ; save old frame pointer mov eBP,eSP ; get new frame pointer sub eSP,localsize ; reserve place for locals . . ; perform calculations, leave result in AX . mov eSP,eBP ; free space for locals pop eBP ; restore old frame pointer ret paramsize ; free parameter space and returnpush eAX ; pass some register resultpush byte[eBP+20] ; pass some memory variable (FASM/TASM syntax)push 3 ; pass some constantcall calc ; the returned result is now in eAXhttp://en.wikipedia.org/wiki/Calling_convention f(x) { ... } f(e1,e2,...,en)
  9. 9. From Malloc/Free to Automatic Memory Management/* Allocate space for an array with ten elements of type int. */int *ptr = (int*)malloc(10 * sizeof (int));if (ptr == NULL) { /* Memory could not be allocated, the program should handle the error here as appropriate. */} else { /* Allocation succeeded. Do something. */ free(ptr); /* We are done with the int objects, and free the associated pointer. */ ptr = NULL; /* The pointer must not be used again, unless re-assigned to using malloc again. */}http://en.wikipedia.org/wiki/Malloc int [] = new int[10]; /* use it; gc will clean up (hopefully) */
  10. 10. Abstractions in Programming Languages❖ Structured control-flow ★ if-then-else, while❖ Procedural abstraction ★ procedures, first-class functions (closures)❖ Memory management ★ garbage collection❖ Data abstraction ★ abstract data types, objects❖ Modules ★ inheritance, traits, mixins
  11. 11. Abstractions in Programming LanguagesAbstraction Scala garbage collection objects Programming Languagesexpressions structured control-flow proceduresmachine
  12. 12. Linguistic Abstraction design abstraction language A language B use new abstractionidentify pattern
  13. 13. What is the Next Level of Abstraction? High-level languages reduce problem/solution gapProblem HLL MachineDomain
  14. 14. Do HLLs Eliminate All Irrelevant Detail?What about❖ data persistence❖ data services❖ concurrency❖ distribution❖ access control❖ data invariants❖ workflow❖ ...
  15. 15. What is the Next Level of Abstraction? High-level languages reduce problem/solution gapProblem HLL MachineDomain
  16. 16. Model-Driven Software Development Problem Model HLL Machine Domainmodels further reduce gap between problem domain and implementation
  17. 17. What is a model?
  18. 18. What is a model? modelthing abstraction of thing abstraction = forgetting details
  19. 19. What is a model?“A model is a simplification of a system built with an intended goalin mind. The model should be able to answer questions in place of the actual system.” Jean Bézivin “A model is an abstraction of a (real or language based) system allowing predictions or inferences to be made.” Kuehne “Models help in developing artefacts by providing informationabout the consequences of building those artefacts before they are actually made.” Ludewig“A model of a system is a description or specification of that system and its environment for some certain purpose.” OMG
  20. 20. What is a model?A model❖ is a simplification of a system ★ abstraction, description, specification, information❖ can answer questions in place of actual system ★ analysis, inference, predictions❖ is used for a purpose ★ understanding, planing, risk analysis, ...
  21. 21. A model is a UML diagram simplification? analysis? purpose?
  22. 22. What is a model about?❖ Structure ★ Data ★ Architecture ★ Configuration❖ Behaviour ★ User interface ★ Access control ★ Business process❖ About any aspects of a system
  23. 23. A model can be a UML diagram ...
  24. 24. A model can be a UML diagram ... ... but it can be any other representation ... e = x | e + e | e - e | f(e,...,e)... that serves the purpose of abstraction, analysis, etc.
  25. 25. For what purposes are models used?Description❖ of something that existsAnalysis❖ understanding of propertiesBlueprint❖ guidelines to build somethingSpecification❖ precise instruction for construction (code gen)
  26. 26. Model-Driven Architecture (MDA)Vision from OMG❖ Models at different level of abstraction ★ Platform Independent Model (PIM) ★ Platform Specific Model (PSM)❖ Model transformation ★ e.g. PIM to PSM to implementation ★ transformations not necessarily automatic❖ UML as standard modeling language ★ models are ‘visual’ or ‘graphical’
  27. 27. ‘Formal Methods’ Formal Methods LogicProblem HLL MachineDomain
  28. 28. A Critique of MDA & Formal MethodsGeneral purpose modeling languages❖ High coverage ★ large class of software systems❖ Low expressivity ★ irrelevant details ★ Requirements/implementation gap not reduced
  29. 29. Domain-Specific LanguagesProblem DSL HLL MachineDomaindomain-specific languages: models specialized to an application domain
  30. 30. DSLs Provide Domain-Specific ...Abstractions ★ directly represent domain conceptsConcrete syntax ★ natural notationOptimization ★ based on domain assumptionsError checking ★ report errors in terms of domain conceptsTool support ★ interpreter, compiler, code generator, IDE
  31. 31. Example Domain-Specific Languages (1)Spreadsheet ★ formulas, macrosQuerying ★ SQL, XQuery, XPathGraph layout ★ GraphVizWeb ★ HTML, CSS, RSS, XML, XSLT ★ Ruby/Rails, JSP, ASP, JSF, WebDSL
  32. 32. Example Domain-Specific Languages (2)Games ★ Lua, UnrealScriptModeling ★ UML, OCL, QVTLanguage processing ★ YACC, LEX, RegExp, ANTLR, SDF ★ TXL, ASF+SDF, Stratego
  33. 33. Transformation TransformationModel analysis Model migration Model construct extract System
  34. 34. External DSLDedicated language ★ independent of host/target language (portable) ★ implementation with interpreter or compilerAdvantages ★ language tuned to domain ★ domain-specific errors, analysis, optimizationsDisadvantages ★ cost of learning new language ★ cost of maintaining language
  35. 35. Internal DSLLibrary in HLL ★ Haskell, Scala, Ruby, ... ★ API is language ★ language features for ‘linguistic abstraction’Advantages ★ host language = implementation languageDisadvantages ★ host language = implementation language (encoding) ★ lack of portability ★ no domain-specific errors, analysis, optimization
  36. 36. Course Goal Course GoalLearn to design and implement domain-specific languages Understand DSL design choices and make reasoned decisions about their application
  37. 37. The Linguistic Abstraction ProcessApplication DSL Domain domain analysis language definitionProgramming abstraction Language Patterns Design
  38. 38. Course Ingredients Lectures* (15x) Designs (2x) Essay (1x)*we have 15 slots for lectures; we don’t need to use them all
  39. 39. Quarter 3 (February - March 2011)Software Development with Domain-Specific Languages
  40. 40. Extension and Evolution of DSLs Model generate customize Code Lecture 2
  41. 41. WebDSL: a DSL for Web Programming Lecture 4
  42. 42. Mobl: a DSL for Mobile Web Applications Lecture 4
  43. 43. A Reactive State-Based DSL for Fountain Control Guest Lecture by Markus Voelter Lectures 5
  44. 44. Automated Coupled Data Evolution Guest Lecture by Sander Vermolen Lectures 6
  45. 45. Domain-Driven Design Guest Lecture by André Boonzaaijer (Sogyo) Lectures 7
  46. 46. Design1: Software Development with DSLsFacebook❖ Status updates selectively accessible to friends❖ Web application in WebDSL❖ Mobile application in mobl connected to web app using services❖ Work in group of 2 to 4 studentsDeadline: April 7❖ submit code and arrange demonstration
  47. 47. Quarter 4 (April - May 2011)Design and Implementation of Domain-Specific Languages
  48. 48. Spoofax: a DSL for Editor Services Lecture 8
  49. 49. SDF: a DSL for Syntax Definition Lecture 8
  50. 50. Stratego: a DSL for Transformation Lecture 9
  51. 51. Code Generation Techniques and ApplicationsCode Generation❖ Print statements❖ String composition❖ Template engines❖ String interpolation❖ Abstract syntax❖ Concrete object syntaxEmbedded DSLs❖ MetaBorg, StringBorg Lecture 10
  52. 52. Advanced Topics❖ Portability ★ supporting multiple platforms❖ Internal DSLs ★ library as a language❖ Language composition ★ combining multiple DSLs❖ Economics ★ costs and benefits of developing (with) DSLs Lectures 11-15
  53. 53. Design 2: Design and Implementation of DSLsDesign and implement a DSL with Spoofax❖ use rule-based DSLs for language definition❖ create full fledged IDEYou propose web app and language to design❖ (We can give tips if you’re stuck)❖ Deadline for proposal: March 22
  54. 54. Essay: Individual Writing ProjectRead❖ recommended papers❖ http://researchr.org/bibliography/mdsdWrite❖ a paper about software development with and of domain-specific languages. ★ Reflect on your experience in design projects ★ Reflect on the literature you’ve read
  55. 55. Gradingfinal grade =❖ 0.35 * design1❖ 0.4 * design2❖ 0.25 * essayall grades should be >= 6
  56. 56. FeedbackI’d like to get feedback early; not when it is too late to fix
  57. 57. ScheduleRead❖ Czarnecki: Overview of Generative Development❖ Muller et al.: Modeling ModelingLecture 2 (February 3)❖ Extension and evolution of DSLsLecture 3 (February 8)❖ WebDSL: a DSL for Web ProgrammingLecture 4 (February 10)❖ Mobl: a DSL for Mobile Web Applications

×