Model-Driven Software Development - Introduction & Overview
The document outlines a lecture on model-driven software development, covering topics such as programming languages, model abstraction, and domain-specific languages (DSLs). It discusses the course structure, including lectures, projects, and exams, aiming to teach students how to design and implement DSLs effectively. Additionally, it emphasizes the importance of models in reducing the gap between problem domains and implementations.
Introduction to the course on Model-Driven Software Development (IN4308) led by Eelco Visser at Delft University.
Overview of the Software Engineering process: Problem Domain to Solution Domain through validation.
Discussion on programming languages and their characteristics, addressing low-level issues and reducing focus on irrelevant details.
Transition from machine language to higher-level representations, showing examples and advantages of programming constructs.
Key abstractions provided by programming languages including structured control flow, memory management, and high-level features.
Defining models in software development, their purpose, structure, behavior, and role in reducing the problem/solution gap.
Uses of models in development including descriptions, analysis, and blueprints. Discussion on Model-Driven Architecture.Introduction to DSLs, their benefits, framework, and applications in specific domains like SQL, web design, and programming.Details about the course curriculum, learning objectives, design projects, assignments, grading, feedback, and resources.
Source: Automatiseringsgids January16, 2010
âGenerator spits out âmobileâ applicationsâ
âSteape has developed a code generator that automatically
generates code for a range of mobile phonesâ
Wednesday, February 3, 2010
4.
Software Engineering
implement
Problem Solution
Domain Domain
validate
Wednesday, February 3, 2010
"A programming languageis low level when its programs
require attention to the irrelevant."
Alan J. Perlis. Epigrams on Programming. SIGPLAN Notices, 17(9):7-13, 1982.
Wednesday, February 3, 2010
7.
What do programminglanguages provide to reduce
attention to the irrelevan?
Wednesday, February 3, 2010
8.
Machine Language toAssembly Language
Program I-I. Disassembly.
., 0360 A9 01Â Â Â LDA #$01
., 0362 A0 00Â Â Â LDY #$00 âLet's 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
Wednesday, February 3, 2010
9.
From Instructions toExpressions
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
Wednesday, February 3, 2010
10.
From Calling Conventionsto Procedures
calc:
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 return
push eAX ; pass some register result
push byte[eBP+20] ; pass some memory variable (FASM/TASM syntax)
push 3 ; pass some constant
call calc ; the returned result is now in eAX
http://en.wikipedia.org/wiki/Calling_convention
f(x) { ... } f(e1,e2,...,en)
Wednesday, February 3, 2010
11.
From Malloc/Free toAutomatic 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) */
Wednesday, February 3, 2010
12.
Abstractions in ProgammingLanguages
- Structured control-ďŹow
â if-then-else, while
- Procedural abstraction
â procedures, ďŹrst-class functions (closures)
- Memory management
â garbage collection
- Data abstraction
â abstract data types, objects
- Modules
â inheritance, traits, mixins
Wednesday, February 3, 2010
13.
Abstraction Scala
garbage collection
objects
Programming Languages
expressions structured
control-ďŹow
procedures
machine
Wednesday, February 3, 2010
14.
Linguistic Abstraction
design abstraction
language A language B
use new abstraction
identify pattern
Wednesday, February 3, 2010
Do HLLs eliminateall irrelevant detail?
What about
- data persistence
- data services
- concurrency
- distribution
- access control
- data invariants
- workďŹow
- ...
Wednesday, February 3, 2010
17.
What is thenext level of abstraction?
Problem
HLL Machine
Domain
Wednesday, February 3, 2010
18.
Model-Driven Software Development
Problem
Model HLL Machine
Domain
models further reduce gap between problem domain and implementation
Wednesday, February 3, 2010
What is amodel?
model
thing abstraction of
thing
abstraction = forgetting details
Wednesday, February 3, 2010
21.
What is amodel?
âA model is a simpliďŹcation of a system built with an intended goal
in mind. The model should be able to answer questions in place of
the actual system.â Jean BĂŠzivin
Wednesday, February 3, 2010
22.
What is amodel?
âA model is an abstraction of a (real or language based) system
allowing predictions or inferences to be made.â Kuehne
Wednesday, February 3, 2010
23.
What is amodel?
âModels help in developing artefacts by providing information
about the consequences of building those artefacts before they
are actually made.â Ludewig
Wednesday, February 3, 2010
24.
What is amodel?
âA model of a system is a description or speciďŹcation of that system
and its environment for some certain purpose.â OMG
Wednesday, February 3, 2010
25.
What is amodel?
A model
- is a simpliďŹcation of a system
â abstraction, description, speciďŹcation, information
- can answer questions in place of actual system
â analysis, inference, predictions
- is used for a purpose
â understanding, planing, risk analysis, ...
Wednesday, February 3, 2010
26.
A model isa UML diagram
simpliďŹcation?
analysis?
purpose?
Wednesday, February 3, 2010
27.
What is amodel about?
- Structure
â Data
â Architecture
â ConďŹguration
- Behaviour
â User interface
â Access control
â Business process
- About any aspects of a system
Wednesday, February 3, 2010
28.
A model canbe a UML diagram ...
Wednesday, February 3, 2010
29.
A model canbe a UML diagram ...
... but it can be any other representation ...
e = x | e + e | e - e | f(e,...,e)
... that serves purpose of abstraction, analysis, etc.
Wednesday, February 3, 2010
30.
For what purposesare models used?
Description
- of something that exists
Analysis
- understanding of properties
Blueprint
- guidelines to build something
SpeciďŹcation
- precise instruction for construction (code gen)
Wednesday, February 3, 2010
31.
Model-Driven Architecture (MDA)
Vision from OMG
- Models at different level of abstraction
â Platform Independent Model (PIM)
â Platform SpeciďŹc 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â
Wednesday, February 3, 2010
A critique ofMDA & formal methods
General purpose modeling languages
- High coverage
â large class of software systems
- Low expressivity
â irrelevant details
â Requirements/implementation gap not reduced
Wednesday, February 3, 2010
34.
Domain-SpeciďŹc Languages
Problem
DSL HLL Machine
Domain
domain-speciďŹc languages: models specialized to an application domain
Wednesday, February 3, 2010
35.
DSLs provide domain-speciďŹc...
Abstractions
â directly represent domain concepts
Concrete syntax
â natural notation
Optimization
â based on domain assumptions
Error checking
â report errors in terms of domain concepts
Tool support
â interpreter, compiler, code generator, IDE
Wednesday, February 3, 2010
Example Domain-SpeciďŹc Languages(2)
Games
â Lua, UnrealScript
Modeling
â UML, OCL, QVT
Language processing
â YACC, LEX, RegExp, ANTLR, SDF
â TXL, ASF+SDF, Stratego
Wednesday, February 3, 2010
38.
Transformation
Model analysis Model migration Model
construct
extract
System
Wednesday, February 3, 2010
39.
External DSL
Dedicated language
â independent of host/target language (portable)
â implementation with interpreter or compiler
Advantages
â language tuned to domain
â domain-speciďŹc errors, analysis, optimizations
Disadvantages
â cost of learning new language
â cost of maintaining language
Wednesday, February 3, 2010
40.
Internal DSL
Library in HLL
â Haskell, Scala, Ruby, ...
â API is language
â language features for âlinguistic abstractionâ
Advantages
â host language = implementation language
Disadvantages
â host language = implementation language (encoding)
â lack of portability
â no domain-speciďŹc errors, analysis, optimization
Wednesday, February 3, 2010
Course Goal
Learn to design and implement
domain-speciďŹc languages
Understand DSL design choices and make
reasoned decisions about their application
Wednesday, February 3, 2010
43.
Application
DSL
Domain
domain analysis
language deďŹnition
Programming abstraction
Language
Patterns Design
Wednesday, February 3, 2010
Customization
Model
generate
customize Code
Lecture 10
Wednesday, February 3, 2010
52.
Advanced Topics
- Economics
â costs and beneďŹts of developing (with) DSLs
- Evolution
â maintenance of models and languages
- Portability
â supporting multiple platforms
- Internal DSLs
â library as a language
- Language composition
â combining multiple DSLs
Lectures 12-14
Wednesday, February 3, 2010
Designs (= labproject in pairs)
Design 1
â Web Application with WebDSL
⢠domain analysis
⢠software development with a DSL
Design 2
â DSL with Stratego & Spoofax/IMP
⢠design and implement a DSL
⢠use rule-based DSLs for language deďŹnition
You propose web app and language to design
â (We can give tips if youâre stuck)
Wednesday, February 3, 2010
Cases (= individualhome work assignments)
- Goals
â understand and apply modeling approaches
â solve small design problems
â compare alternative solutions
- Six cases
â domain analysis and data modeling
â web abstractions
â language modeling
â generation, transformation, analysis
â customization
â advanced topic
Wednesday, February 3, 2010
Exams
Goals
- test understanding of course material
- small design problems
- comparison of approaches
When
- midterm (after period 3)
- ďŹnal (after period 4)
- if(midterm >= 6) { make half of ďŹnal exam }
Wednesday, February 3, 2010
59.
Grading
design := 0.4 * design1 + 0.6 * design2
exam := if(exam1 >= 6) {
(exam1 + exam2)/2 }
} else { exam2 }
case := average(i : 1 to 6) { case[i] }
final := 0.4 * design + 0.2 * case + 0.4 * exam
pass := design1 >= 6 && design2 >= 6 && exam >= 6
&& [c | c in case where c >= 6].length >= 4
Wednesday, February 3, 2010
60.
Feedback
This is a new course
Iâd like to get feedback early
Not when it is too late to ďŹx
Volunteers for feedback group?
Short meeting Thursdays at start of lab
Wednesday, February 3, 2010
61.
Website
http://department.st.ewi.tudelft.nl/course/IN4308
Wednesday, February 3, 2010
62.
Schedule
Lab this week:
â Find a partner
â Make design proposal for a web application
â WebDSL tutorial
Read
â Czarnecki: Overview of Generative Development
â Muller et al.: Modeling Modeling
Next week
â Domain analysis & data modeling
No lecture week 4, moved to week 8!
Wednesday, February 3, 2010