SlideShare a Scribd company logo
1 of 57
Download to read offline
Model-Driven
 Software Development

            Lecture1: Introduction & Overview


                                              Course IN4308
     Eelco Visser
                                   Master Computer Science
http://eelcovisser.org         Delft University of Technology
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”
Software Engineering




                implement
Problem                          Solution
Domain                           Domain
                  validate
Programming Languages
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.
Machine Language to Assembly 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
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
From Calling Conventions to 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)
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) */
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
Abstractions in Programming Languages

Abstraction                                    Scala
                        garbage collection
              objects


      Programming Languages
expressions                       structured
                                 control-flow

                  procedures
machine
Linguistic Abstraction


                            design abstraction
          language A                             language B



                           use new abstraction


identify pattern
What is the Next Level of Abstraction?
   High-level languages reduce problem/solution gap




Problem
                                 HLL           Machine
Domain
Do HLLs Eliminate All Irrelevant Detail?

What about
❖ data persistence
❖ data services
❖ concurrency
❖ distribution
❖ access control
❖ data invariants
❖ workflow
❖ ...
What is the Next Level of Abstraction?
   High-level languages reduce problem/solution gap




Problem
                                 HLL           Machine
Domain
Model-Driven Software Development




 Problem
                    Model               HLL             Machine
 Domain




models further reduce gap between problem domain and implementation
What is a model?
What is a model?




                                           model
thing                abstraction             of
                                           thing




        abstraction = forgetting details
What is a model?


“A model is a simplification 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

   “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 information
about 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
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, ...
A model is a UML diagram




                           simplification?
                              analysis?
                             purpose?
What is a model about?


❖ Structure
  ★ Data
  ★ Architecture
  ★ Configuration

❖ Behaviour
  ★ User interface
  ★ Access control
  ★ Business process

❖ About any aspects of a system
A model can be a UML diagram ...
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.
For what purposes are models used?

Description
❖ of something that exists
Analysis
❖ understanding of properties
Blueprint
❖ guidelines to build something
Specification
❖ precise instruction for construction (code gen)
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’
‘Formal Methods’ Formal Methods


                          Logic




Problem
                          HLL     Machine
Domain
A Critique of MDA & Formal Methods




General purpose modeling languages
❖ High coverage
  ★ large class of software systems

❖ Low expressivity
  ★ irrelevant details
  ★ Requirements/implementation gap not reduced
Domain-Specific Languages




Problem
                     DSL                  HLL              Machine
Domain




domain-specific languages: models specialized to an application domain
DSLs Provide Domain-Specific ...
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
Example Domain-Specific Languages (1)

Spreadsheet
  ★ formulas, macros

Querying
  ★ SQL, XQuery, XPath

Graph layout
  ★ GraphViz

Web
  ★ HTML, CSS, RSS, XML, XSLT
  ★ Ruby/Rails, JSP, ASP, JSF, WebDSL
Example Domain-Specific Languages (2)



Games
  ★ Lua, UnrealScript

Modeling
  ★ UML, OCL, QVT

Language processing
  ★ YACC, LEX, RegExp, ANTLR, SDF
  ★ TXL, ASF+SDF, Stratego
Transformation
                   Transformation



Model   analysis        Model               migration   Model



                      construct


                                  extract




                      System
External DSL

Dedicated language
  ★ independent of host/target language (portable)
  ★ implementation with interpreter or compiler

Advantages
  ★ language tuned to domain
  ★ domain-specific errors, analysis, optimizations

Disadvantages
  ★ cost of learning new language
  ★ cost of maintaining language
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-specific errors, analysis, optimization
Course Goal
                Course Goal




Learn to design and implement
  domain-specific languages
   Understand DSL design choices and make
   reasoned decisions about their application
The Linguistic Abstraction Process


Application
                                       DSL
 Domain
    domain analysis




                                        language definition
Programming           abstraction
                                     Language
  Patterns                            Design
Course Ingredients




   Lectures* (15x)

        Designs (2x)

             Essay (1x)
*we have 15 slots for lectures; we don’t need to use them all
Quarter 3
            (February - March 2011)



Software Development with Domain-Specific Languages
Extension and Evolution of DSLs



             Model




              generate




 customize   Code
                                  Lecture 2
WebDSL: a DSL for Web Programming




                              Lecture 4
Mobl: a DSL for Mobile Web Applications




                                   Lecture 4
A Reactive State-Based DSL for Fountain Control


                                Guest Lecture by
                                 Markus Voelter




                                      Lectures 5
Automated Coupled Data Evolution




                         Guest Lecture by
                         Sander Vermolen




                              Lectures 6
Domain-Driven Design




               Guest Lecture by
               André Boonzaaijer
                   (Sogyo)




                       Lectures 7
Design1: Software Development with DSLs


Facebook
❖ 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 students
Deadline: April 7
❖ submit code and arrange demonstration
Quarter 4
                (April - May 2011)


Design and Implementation of Domain-Specific Languages
Spoofax: a DSL for Editor Services




                                 Lecture 8
SDF: a DSL for Syntax Definition




                                  Lecture 8
Stratego: a DSL for Transformation




                                 Lecture 9
Code Generation Techniques and Applications

Code Generation
❖ Print statements
❖ String composition
❖ Template engines
❖ String interpolation
❖ Abstract syntax
❖ Concrete object syntax
Embedded DSLs
❖ MetaBorg, StringBorg
                                     Lecture 10
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
Design 2: Design and Implementation of DSLs


Design and implement a DSL with Spoofax
❖ use rule-based DSLs for language definition
❖ create full fledged IDE


You propose web app and language to design
❖ (We can give tips if you’re stuck)
❖ Deadline for proposal: March 22
Essay: Individual Writing Project



Read
❖ recommended papers
❖ http://researchr.org/bibliography/mdsd
Write
❖ 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
Grading




final grade =
❖ 0.35 * design1
❖ 0.4 * design2
❖ 0.25 * essay
all grades should be >= 6
Feedback




I’d like to get feedback early; not when it is too late to fix
Schedule

Read
❖ Czarnecki: Overview of Generative Development
❖ Muller et al.: Modeling Modeling
Lecture 2 (February 3)
❖ Extension and evolution of DSLs
Lecture 3 (February 8)
❖ WebDSL: a DSL for Web Programming
Lecture 4 (February 10)
❖ Mobl: a DSL for Mobile Web Applications

More Related Content

What's hot

A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency ConstructsTed Leung
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mindSander Mak (@Sander_Mak)
 
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Shinpei Hayashi
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scalapramode_ce
 
Functional Programming in Scala: Notes
Functional Programming in Scala: NotesFunctional Programming in Scala: Notes
Functional Programming in Scala: NotesRoberto Casadei
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#Alfonso Garcia-Caro
 
Practical Models in Practice
Practical Models in PracticePractical Models in Practice
Practical Models in PracticeCHOOSE
 
14.jun.2012
14.jun.201214.jun.2012
14.jun.2012Tech_MX
 
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingPython Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingRanel Padon
 
C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP ImplementationFridz Felisco
 

What's hot (20)

A Survey of Concurrency Constructs
A Survey of Concurrency ConstructsA Survey of Concurrency Constructs
A Survey of Concurrency Constructs
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 
Learning c++
Learning c++Learning c++
Learning c++
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
Generating Assertion Code from OCL: A Transformational Approach Based on Simi...
 
Scala google
Scala google Scala google
Scala google
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 
Basic lisp
Basic lispBasic lisp
Basic lisp
 
Functional Programming in Scala: Notes
Functional Programming in Scala: NotesFunctional Programming in Scala: Notes
Functional Programming in Scala: Notes
 
Functional Programming in C# and F#
Functional Programming in C# and F#Functional Programming in C# and F#
Functional Programming in C# and F#
 
Practical Models in Practice
Practical Models in PracticePractical Models in Practice
Practical Models in Practice
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
Swift, swiftly
Swift, swiftlySwift, swiftly
Swift, swiftly
 
14.jun.2012
14.jun.201214.jun.2012
14.jun.2012
 
Special topics in finance lecture 2
Special topics in finance   lecture 2Special topics in finance   lecture 2
Special topics in finance lecture 2
 
Google06
Google06Google06
Google06
 
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingPython Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator Overloading
 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdf
 
C++ OOP Implementation
C++ OOP ImplementationC++ OOP Implementation
C++ OOP Implementation
 

Viewers also liked

Model driven development
Model driven developmentModel driven development
Model driven developmentPaul Jewell
 
Model-Driven Software Development 2.0
Model-Driven Software Development 2.0Model-Driven Software Development 2.0
Model-Driven Software Development 2.0Etienne Juliot
 
Service Cloud für Fortgeschrittene – Die Roadmap für 2012
Service Cloud für Fortgeschrittene – Die Roadmap für 2012Service Cloud für Fortgeschrittene – Die Roadmap für 2012
Service Cloud für Fortgeschrittene – Die Roadmap für 2012Salesforce Deutschland
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile ServicesJan Hentschel
 
Israel redefining innovation at International CES 2015
Israel redefining innovation at International CES 2015Israel redefining innovation at International CES 2015
Israel redefining innovation at International CES 2015FSJU AUJF
 
iPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneiPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneHeiko Behrens
 
Model Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model EvolutionModel Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model EvolutionSander Vermolen
 
Getting Started with Big Data for Business Managers
Getting Started with Big Data for Business ManagersGetting Started with Big Data for Business Managers
Getting Started with Big Data for Business ManagersDatameer
 
Agile MDD
Agile MDDAgile MDD
Agile MDDfntnhd
 
Schatten IT erfolgreich bekämpfen
Schatten IT erfolgreich bekämpfenSchatten IT erfolgreich bekämpfen
Schatten IT erfolgreich bekämpfenNiels de Bruijn
 
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTModell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTjoergreichert
 
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...Salesforce Deutschland
 
Analyzing Unstructured Data in Hadoop Webinar
Analyzing Unstructured Data in Hadoop WebinarAnalyzing Unstructured Data in Hadoop Webinar
Analyzing Unstructured Data in Hadoop WebinarDatameer
 
Software is eating the world and MDD should be in the driving seat
Software is eating the world and MDD should be in the driving seatSoftware is eating the world and MDD should be in the driving seat
Software is eating the world and MDD should be in the driving seatJohan den Haan
 
Paydirekt - Ein kurzer Walkthrough
Paydirekt - Ein kurzer WalkthroughPaydirekt - Ein kurzer Walkthrough
Paydirekt - Ein kurzer WalkthroughMaik Klotz
 
Why there is no future for Model Driven Development
Why there is no future for Model Driven DevelopmentWhy there is no future for Model Driven Development
Why there is no future for Model Driven DevelopmentJohan den Haan
 
Payment und Fintech in Deutschland. Versuch einer Übersicht
Payment und Fintech in Deutschland. Versuch einer ÜbersichtPayment und Fintech in Deutschland. Versuch einer Übersicht
Payment und Fintech in Deutschland. Versuch einer ÜbersichtMaik Klotz
 

Viewers also liked (20)

Model driven development
Model driven developmentModel driven development
Model driven development
 
Model-Driven Software Development 2.0
Model-Driven Software Development 2.0Model-Driven Software Development 2.0
Model-Driven Software Development 2.0
 
Service Cloud für Fortgeschrittene – Die Roadmap für 2012
Service Cloud für Fortgeschrittene – Die Roadmap für 2012Service Cloud für Fortgeschrittene – Die Roadmap für 2012
Service Cloud für Fortgeschrittene – Die Roadmap für 2012
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile Services
 
Israel redefining innovation at International CES 2015
Israel redefining innovation at International CES 2015Israel redefining innovation at International CES 2015
Israel redefining innovation at International CES 2015
 
Datameer
DatameerDatameer
Datameer
 
iPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneiPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhone
 
Model Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model EvolutionModel Driven Software Development - Data Model Evolution
Model Driven Software Development - Data Model Evolution
 
Getting Started with Big Data for Business Managers
Getting Started with Big Data for Business ManagersGetting Started with Big Data for Business Managers
Getting Started with Big Data for Business Managers
 
Agile MDD
Agile MDDAgile MDD
Agile MDD
 
APEX 5.0, und sonst?
APEX 5.0, und sonst?APEX 5.0, und sonst?
APEX 5.0, und sonst?
 
Schatten IT erfolgreich bekämpfen
Schatten IT erfolgreich bekämpfenSchatten IT erfolgreich bekämpfen
Schatten IT erfolgreich bekämpfen
 
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXTModell-getriebene Softwareentwicklung für Lego Mindstorms NXT
Modell-getriebene Softwareentwicklung für Lego Mindstorms NXT
 
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...
ET Marketing Cloud - Erfolgreich in B2B und B2C mit der Salesforce ExactTarge...
 
Analyzing Unstructured Data in Hadoop Webinar
Analyzing Unstructured Data in Hadoop WebinarAnalyzing Unstructured Data in Hadoop Webinar
Analyzing Unstructured Data in Hadoop Webinar
 
CG2010 Introducing MDSD
CG2010 Introducing MDSDCG2010 Introducing MDSD
CG2010 Introducing MDSD
 
Software is eating the world and MDD should be in the driving seat
Software is eating the world and MDD should be in the driving seatSoftware is eating the world and MDD should be in the driving seat
Software is eating the world and MDD should be in the driving seat
 
Paydirekt - Ein kurzer Walkthrough
Paydirekt - Ein kurzer WalkthroughPaydirekt - Ein kurzer Walkthrough
Paydirekt - Ein kurzer Walkthrough
 
Why there is no future for Model Driven Development
Why there is no future for Model Driven DevelopmentWhy there is no future for Model Driven Development
Why there is no future for Model Driven Development
 
Payment und Fintech in Deutschland. Versuch einer Übersicht
Payment und Fintech in Deutschland. Versuch einer ÜbersichtPayment und Fintech in Deutschland. Versuch einer Übersicht
Payment und Fintech in Deutschland. Versuch einer Übersicht
 

Similar to IN4308 1

Programing paradigm & implementation
Programing paradigm & implementationPrograming paradigm & implementation
Programing paradigm & implementationBilal Maqbool ツ
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langaugemustafkhalid
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSkills Matter
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futureTakayuki Muranushi
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeDmitri Nesteruk
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.Ruslan Shevchenko
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming languageVasavi College of Engg
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonRalf Gommers
 
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Ovidiu Farauanu
 
SiriusCon 2015 - Breathe Life into Your Designer!
SiriusCon 2015 - Breathe Life into Your Designer!SiriusCon 2015 - Breathe Life into Your Designer!
SiriusCon 2015 - Breathe Life into Your Designer!melbats
 
Intermachine Parallelism
Intermachine ParallelismIntermachine Parallelism
Intermachine ParallelismSri Prasanna
 

Similar to IN4308 1 (20)

Programing paradigm & implementation
Programing paradigm & implementationPrograming paradigm & implementation
Programing paradigm & implementation
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
 
Erlang, an overview
Erlang, an overviewErlang, an overview
Erlang, an overview
 
MXNet Workshop
MXNet WorkshopMXNet Workshop
MXNet Workshop
 
Simon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelismSimon Peyton Jones: Managing parallelism
Simon Peyton Jones: Managing parallelism
 
Peyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_futurePeyton jones-2011-parallel haskell-the_future
Peyton jones-2011-parallel haskell-the_future
 
Unmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/InvokeUnmanaged Parallelization via P/Invoke
Unmanaged Parallelization via P/Invoke
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
Tutorial
TutorialTutorial
Tutorial
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Standardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for PythonStandardizing on a single N-dimensional array API for Python
Standardizing on a single N-dimensional array API for Python
 
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
 
SiriusCon 2015 - Breathe Life into Your Designer!
SiriusCon 2015 - Breathe Life into Your Designer!SiriusCon 2015 - Breathe Life into Your Designer!
SiriusCon 2015 - Breathe Life into Your Designer!
 
Intermachine Parallelism
Intermachine ParallelismIntermachine Parallelism
Intermachine Parallelism
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
C Language
C LanguageC Language
C Language
 
C Tutorials
C TutorialsC Tutorials
C Tutorials
 
Introduction to F#
Introduction to F#Introduction to F#
Introduction to F#
 

More from Eelco Visser

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingEelco Visser
 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesEelco Visser
 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingEelco Visser
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionEelco Visser
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionEelco Visser
 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesEelco Visser
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with StatixEelco Visser
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionEelco Visser
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Eelco Visser
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementEelco Visser
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersEelco Visser
 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationEelco Visser
 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesEelco Visser
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksEelco Visser
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisEelco Visser
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionEelco Visser
 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsEelco Visser
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingEelco Visser
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisEelco Visser
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingEelco Visser
 

More from Eelco Visser (20)

CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
CS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic ServicesCS4200 2019 | Lecture 4 | Syntactic Services
CS4200 2019 | Lecture 4 | Syntactic Services
 
CS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | ParsingCS4200 2019 | Lecture 3 | Parsing
CS4200 2019 | Lecture 3 | Parsing
 
CS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definitionCS4200 2019 | Lecture 2 | syntax-definition
CS4200 2019 | Lecture 2 | syntax-definition
 
CS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: IntroductionCS4200 2019 Lecture 1: Introduction
CS4200 2019 Lecture 1: Introduction
 
A Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation RulesA Direct Semantics of Declarative Disambiguation Rules
A Direct Semantics of Declarative Disambiguation Rules
 
Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
 
Compiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler ConstructionCompiler Construction | Lecture 17 | Beyond Compiler Construction
Compiler Construction | Lecture 17 | Beyond Compiler Construction
 
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)Domain Specific Languages for Parallel Graph AnalytiX (PGX)
Domain Specific Languages for Parallel Graph AnalytiX (PGX)
 
Compiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory ManagementCompiler Construction | Lecture 15 | Memory Management
Compiler Construction | Lecture 15 | Memory Management
 
Compiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | InterpretersCompiler Construction | Lecture 14 | Interpreters
Compiler Construction | Lecture 14 | Interpreters
 
Compiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code GenerationCompiler Construction | Lecture 13 | Code Generation
Compiler Construction | Lecture 13 | Code Generation
 
Compiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual MachinesCompiler Construction | Lecture 12 | Virtual Machines
Compiler Construction | Lecture 12 | Virtual Machines
 
Compiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone FrameworksCompiler Construction | Lecture 11 | Monotone Frameworks
Compiler Construction | Lecture 11 | Monotone Frameworks
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 
Compiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint ResolutionCompiler Construction | Lecture 9 | Constraint Resolution
Compiler Construction | Lecture 9 | Constraint Resolution
 
Compiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type ConstraintsCompiler Construction | Lecture 8 | Type Constraints
Compiler Construction | Lecture 8 | Type Constraints
 
Compiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type CheckingCompiler Construction | Lecture 7 | Type Checking
Compiler Construction | Lecture 7 | Type Checking
 
Compiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static AnalysisCompiler Construction | Lecture 6 | Introduction to Static Analysis
Compiler Construction | Lecture 6 | Introduction to Static Analysis
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 

IN4308 1

  • 1. Model-Driven Software Development Lecture1: Introduction & Overview Course IN4308 Eelco Visser Master Computer Science http://eelcovisser.org Delft University of Technology
  • 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. Software Engineering implement Problem Solution Domain Domain validate
  • 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. Machine Language to Assembly 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
  • 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. From Calling Conventions to 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)
  • 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. 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. Abstractions in Programming Languages Abstraction Scala garbage collection objects Programming Languages expressions structured control-flow procedures machine
  • 12. Linguistic Abstraction design abstraction language A language B use new abstraction identify pattern
  • 13. What is the Next Level of Abstraction? High-level languages reduce problem/solution gap Problem HLL Machine Domain
  • 14. Do HLLs Eliminate All Irrelevant Detail? What about ❖ data persistence ❖ data services ❖ concurrency ❖ distribution ❖ access control ❖ data invariants ❖ workflow ❖ ...
  • 15. What is the Next Level of Abstraction? High-level languages reduce problem/solution gap Problem HLL Machine Domain
  • 16. Model-Driven Software Development Problem Model HLL Machine Domain models further reduce gap between problem domain and implementation
  • 17. What is a model?
  • 18. What is a model? model thing abstraction of thing abstraction = forgetting details
  • 19. What is a model? “A model is a simplification 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 “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 information about 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. 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. A model is a UML diagram simplification? analysis? purpose?
  • 22. What is a model about? ❖ Structure ★ Data ★ Architecture ★ Configuration ❖ Behaviour ★ User interface ★ Access control ★ Business process ❖ About any aspects of a system
  • 23. A model can be a UML diagram ...
  • 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. For what purposes are models used? Description ❖ of something that exists Analysis ❖ understanding of properties Blueprint ❖ guidelines to build something Specification ❖ precise instruction for construction (code gen)
  • 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. ‘Formal Methods’ Formal Methods Logic Problem HLL Machine Domain
  • 28. A Critique of MDA & Formal Methods General purpose modeling languages ❖ High coverage ★ large class of software systems ❖ Low expressivity ★ irrelevant details ★ Requirements/implementation gap not reduced
  • 29. Domain-Specific Languages Problem DSL HLL Machine Domain domain-specific languages: models specialized to an application domain
  • 30. DSLs Provide Domain-Specific ... 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
  • 31. Example Domain-Specific Languages (1) Spreadsheet ★ formulas, macros Querying ★ SQL, XQuery, XPath Graph layout ★ GraphViz Web ★ HTML, CSS, RSS, XML, XSLT ★ Ruby/Rails, JSP, ASP, JSF, WebDSL
  • 32. Example Domain-Specific Languages (2) Games ★ Lua, UnrealScript Modeling ★ UML, OCL, QVT Language processing ★ YACC, LEX, RegExp, ANTLR, SDF ★ TXL, ASF+SDF, Stratego
  • 33. Transformation Transformation Model analysis Model migration Model construct extract System
  • 34. External DSL Dedicated language ★ independent of host/target language (portable) ★ implementation with interpreter or compiler Advantages ★ language tuned to domain ★ domain-specific errors, analysis, optimizations Disadvantages ★ cost of learning new language ★ cost of maintaining language
  • 35. 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-specific errors, analysis, optimization
  • 36. Course Goal Course Goal Learn to design and implement domain-specific languages Understand DSL design choices and make reasoned decisions about their application
  • 37. The Linguistic Abstraction Process Application DSL Domain domain analysis language definition Programming abstraction Language Patterns Design
  • 38. Course Ingredients Lectures* (15x) Designs (2x) Essay (1x) *we have 15 slots for lectures; we don’t need to use them all
  • 39. Quarter 3 (February - March 2011) Software Development with Domain-Specific Languages
  • 40. Extension and Evolution of DSLs Model generate customize Code Lecture 2
  • 41. WebDSL: a DSL for Web Programming Lecture 4
  • 42. Mobl: a DSL for Mobile Web Applications Lecture 4
  • 43. A Reactive State-Based DSL for Fountain Control Guest Lecture by Markus Voelter Lectures 5
  • 44. Automated Coupled Data Evolution Guest Lecture by Sander Vermolen Lectures 6
  • 45. Domain-Driven Design Guest Lecture by André Boonzaaijer (Sogyo) Lectures 7
  • 46. Design1: Software Development with DSLs Facebook ❖ 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 students Deadline: April 7 ❖ submit code and arrange demonstration
  • 47. Quarter 4 (April - May 2011) Design and Implementation of Domain-Specific Languages
  • 48. Spoofax: a DSL for Editor Services Lecture 8
  • 49. SDF: a DSL for Syntax Definition Lecture 8
  • 50. Stratego: a DSL for Transformation Lecture 9
  • 51. Code Generation Techniques and Applications Code Generation ❖ Print statements ❖ String composition ❖ Template engines ❖ String interpolation ❖ Abstract syntax ❖ Concrete object syntax Embedded DSLs ❖ MetaBorg, StringBorg Lecture 10
  • 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. Design 2: Design and Implementation of DSLs Design and implement a DSL with Spoofax ❖ use rule-based DSLs for language definition ❖ create full fledged IDE You propose web app and language to design ❖ (We can give tips if you’re stuck) ❖ Deadline for proposal: March 22
  • 54. Essay: Individual Writing Project Read ❖ recommended papers ❖ http://researchr.org/bibliography/mdsd Write ❖ 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. Grading final grade = ❖ 0.35 * design1 ❖ 0.4 * design2 ❖ 0.25 * essay all grades should be >= 6
  • 56. Feedback I’d like to get feedback early; not when it is too late to fix
  • 57. Schedule Read ❖ Czarnecki: Overview of Generative Development ❖ Muller et al.: Modeling Modeling Lecture 2 (February 3) ❖ Extension and evolution of DSLs Lecture 3 (February 8) ❖ WebDSL: a DSL for Web Programming Lecture 4 (February 10) ❖ Mobl: a DSL for Mobile Web Applications