SlideShare a Scribd company logo
1 of 69
Download to read offline
Generative Software Development
          overview and examples


               Eelco Visser
             visser@acm.org
      Universiteit Utrecht, Faculty of Science,
Department of Information and Computing Sciences,
          Center for Software Technology


              October 27, 2005
Generative Software Development



       Generative software development is a system-family
       approach, which focuses on automating the creation of
       system-family members: a given system can be
       automatically generated from a specification written in
       one or more domain-specific languages.




  K. Czarnecki. Overview of Generative Software Development. In J.-P. Bantre
  et al. (Eds.): Unconventional Programming Paradigms (UPP) 2004, Mont
  Saint-Michel, France, LNCS 3566, pp. 313-328, 2005
Outline
    • Software system families
          • Commonality and variability
          • Domain engineering and application engineering
          • Feature modeling
    • Domain-specific languages
          • Examples
    • Generative programming
          • Problem space
          • Solution space
          • Mapping
    • Realizing generative software development
          • Overview of techniques
          • Example: assimilating embedded DSLs
    • Risks
    • Summary
Software System Families




      Current research and practical experience suggest that
      achieving significant progress with respect to software
      reuse requires a paradigm shift towards modeling and
      developing software system families rather than
      individual systems.
                                                 Czarnecki 2005
Examples of Software System Families


    • Compilers
        • program representation, parsing, code generation, ...
    • Web applications
        • processing http requests, session management
    • E-commerce systems
        • products, user accounts, payment
    • Office applications
        • text processing
    • Web browsers
        • html rendering
    • TV software
System Family Engineering




      System-family engineering (product-line engineering)
      seeks to exploit the commonalities among systems from
      a given problem domain while managing the variabilities
      among them in a systematic way.
                                             Czarnecki 2005
Commonality and Variability



    • E-commerce systems
        • Commonalities: products, user accounts, payment, ...
        • Variabilities: types of products, shipment methods, ...
    • Web applications
        • Commonalities: processing http requests, session management
        • Variabilities: application workflow, page layout, ...
    • Web browsers
        • Commonalities: render HTML
        • Variabilities: plugins for email, chatting, ...
Commonality and Variability



    • Compilers
        • Commonalities: program representation, parsing, code
          generation, ...
        • Variabilities: syntax and semantics of language
    • Office applications
        • Commonalities: text processing
        • Variabilities: spellchecking, grammarchecking, ...
    • TV software
        • Commonalities: ?
        • Variabilities: ?
System Family Engineering Process


                     system family engineering
                                 =
                        domain engineering
                                 +
                      application engineering



                                reusable assets
        Domain engineering                        Application engineering
         Domain analysis       new requirements    System requirements
          Domain design                             System derivation
       Domain implementation                         System tailoring
Domain Engineering = Development for Reuse

  Development of reusable assets
    • Reusable components, generic architectures, documentation
  Software engineering process for a class of systems
    • Domain analysis
         • scope of family
         • identify commonalities and variabilities
    • Domain design
         • common architecture
         • plan creation of systems from reusable assets
    • Domain implementation
         • implementation of reusable assets
Feature Modeling

  A method and notation to elicit and represent common and
  variable features of the systems in a system family
    • And: all subfeatures must be selected
    • Alternative: only one subfeature can be selected
    • Or: one or more can be selected
    • Mandatory: features that are required
    • Optional: features that are optional
  Additional information
    • constraints
    • binding times
    • default attribute values, default features
    • stakeholders, priorities, etc.
Feature Modeling: Example




                                                     e-shop




                     payment                      taxCalculation      shipping




  creditCard   debitCard       electronicCheque       addressResolution




                                          country        postalCode       streetAddress
Feature Modeling: Alternative Notations


     • Feature diagrams can be expressed as context-free grammars
     • Feature selection is sentence generated by the grammar

   e-shop : payment taxCalculation [shipping]
   payment : paymentMethod+
   paymentMethod : creditCard | debitCard | electronicCheque
   taxCalculation : addressResolution
   addressResolution : country | postalCode | streetAddres


     • Expressivity of feature diagrams is restricted
     • Features and other constraints can be expressed by means of
       propositional formulae
   See also D. Batory. Feature Models, Grammars, and Propositional Formulas. In
   H. Obbink and K. Pohl (Eds.) SPLC 2005. LNCS 3714, pp. 7–20, 2005
Application Engineering = Development with Reuse



  Build concrete applications using reusable assets
    • Requirements = delta of generic system requirements
    • System derivation: manual or automated construction of
      system from reusable assets
  Feedback to domain engineering
    • Refine and adapt requirements
    • Tailor reusable assets to application
Features vs Software Modules

  Concrete features
    • map to individual components
  Crosscutting features
    • can be implemented using aspect-oriented techniques
    • Examples: logging, synchronization
  Abstract features
    • Also known as: non-functional requirements
    • map to configuration of components and/or aspects
  Grouping features
    • Also known as: variation points
    • map to common interface and plug-compatible components
Generative Software Development




      Generative software development is a system-family
      approach, which focuses on automating the creation of
      system-family members: a given system can be
      automatically generated from a specification written in
      one or more domain-specific languages.
                                              Czarnecki 2005
General Purpose Languages


  Expressivity of general purpose languages is restricted to
    • while(cond) { x = foo(y, z); }
    • variable binding: storing values
    • function calls: computing values
    • control-flow: combining and choosing computations
  This is a rather powerful and generic approach
    • any computation can be expressed (Turing completeness)
    • modularization facilities allow further abstraction
  But it does not match application domains very well
Advantages of Domain-Specific Languages


    • Domain-specific abstractions
        • pre-defined abstractions for concepts in application domain
    • Domain-specific concrete syntax
        • natural notation for a domain
    • Domain-specific error checking
        • find and report errors based on domain knowledge and notation
    • Domain-specific optimizations
        • opportunities for optimizations based on domain knowledge
    • Domain-specific tool support
        • tools can be aware of domain
Domain-Specific Languages: Examples



  Successful domain-specific languages exist for many domains
    • Numerical computation
    • Database queries
    • Text search and analysis
    • Symbolic computation
    • Document transformation
    • Workflow
    • ...
Domain-Specific Languages: Arithmetic

  x = c * y + z

    • Notation and semantics based on long tradition in
      mathematics
    • General purpose language notation would require

  x = plus(times(c, y), z)
  x = z.plus(y.times(c))
  x = c.times(y).plus(z)

    • Compiler knows a lot about arithmetic
        • optimizations (partial evaluation, strength reduction, ...)
        • automatic coercions (int to real)
        • exceptions
Domain-Specific Languages:

  A = c * B + C
Domain-Specific Languages: Matrix Computation

  A = c * B + C

    • Now the elements of the assignment are matrices
    • The expression ‘means’

  for i = lb to ub do
    A[i] = c * B[i] + C[i]
Domain-Specific Languages: Matrix Computation

  A = c * B + C

    • Now the elements of the assignment are matrices
    • The expression ‘means’

  for i = lb to ub do
    A[i] = c * B[i] + C[i]

    • General-purpose languages (C, C++, Java, ...) don’t
      understand matrices
    • ‘Mathematical’ languages such as Matlab and Octave do
    • Matrix notation allows
        • concise programs
        • compiler may apply optimizations
Domain-Specific Languages: Database Queries


  SELECT NAME
  FROM ORDERS, INCLUDES, SUPPLIES
  WHERE CUST = ’Chaudron’
     AND ORDERS.O# = INCLUDUES.O#
     AND INCLUDES.ITEM = SUPPLIES.ITEM

    • SQL: notation for querying relational databases
    • Abstracts from physical data structures of database
    • Based on small set of relational algebra operators

    • Allows efficient implementation of queries
    • Queries can be checked against database schema
Domain-Specific Languages: Regular Expressions



  ^([a-z]+)/([A-Z][^/]+)/(.*)

    • A regular expression describes or matches a set of strings,
      according to certain syntax rules
    • Used by many text editors and utilities to search and
      manipulate bodies of text based on certain patterns.
    • Many programming languages support regular expressions for
      string manipulation.

    • Notation abstracts from underlying finite automata
Domain-Specific Languages: Context-free Grammars



  <postal-address> ::= <name-part> <street-address> <zip-part>
  <personal-part> ::= <first-name> | <initial> "."
  <name-part> ::= <personal-part> <last-name> [<jr-part>] <EOL>
                  | <personal-part> <name-part>
  <street-address> ::= [<apt>] <house-num> <street-name> <EOL>
  <zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL>


    • Describes syntax of a formal language
    • Used to derive parsers that automatically recognize texts
    • Writing parsers manually is complex and error-prone
Domain-Specific Languages: Rewrite Systems




  |[ if 0 then s1 else s2 ]| -> |[ s2 ]|

  |[ i + j ]| -> |[ k ]| where <add>(i,j) => k

    • Rewrite rule replaces a matching term with another term
    • Exhaustive application of rules reduces term to normal form
    • Applications: symbolic computation, program transformation,
Domain-Specific Languages: Path Queries




  /bookstore/book[price>35]/title

    • XPATH path queries address parts of an XML document
    • used in document transformation with XSLT
Domain-Specific Languages: Workflow
Domain-Specific Languages: Observations




    • Domain-specific languages are everywhere

    • DSL are sucessful when they cover a well-defined domain and
      are based on solid foundations

    • DSLs typically do not cover entire systems, but rather
      well-defined parts/aspects of systems
Generative Software Development




      Generative software development is a system-family
      approach, which focuses on automating the creation of
      system-family members: a given system can be
      automatically generated from a specification written in
      one or more domain-specific languages.
                                              Czarnecki 2005
Generative Programming: Mapping Problems to Solutions



                                mapping
          Problem space                        Solution space



  Problem Space
    • Set of domain specific abstractions
    • Used to specify desired system family member
  Solution Space
    • Implementation oriented abstractions
    • Can be instantiated to implement domain abstractions
Problem Space and Solution Space: Example



  Problem Space
    • Regular expressions
  Solution Space
    • Finite automata
    • Expressed as transition table in code
  Mapping
    • Lexical analyzer generator (flex)
Mapping: Configuration View

  Problem space
    • domain-specific concepts and their features
    • constraints: illegal feature combinations, default settings,
      default dependencies
  Specification
    • selection of features for a specific system
  Solution space
    • implementation components, composed to create system
  Mapping
    • feature configuration mapped to component configuration
    • mapping defined by construction rules and optimizations
  Separation of spaces allows freedom of implementation
Configuration Example: Apache’s httpd.conf

  Software composition
  LoadModule file_cache_module modules/mod_file_cache.so
  LoadModule mem_cache_module modules/mod_mem_cache.so
  LoadModule cgi_module modules/mod_cgi.so

  Configuration settings
  <Directory /home/*/public_html>
      AllowOverride FileInfo AuthConfig Limit
      Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
      <Limit GET POST OPTIONS>
          Order allow,deny
          Allow from all
      </Limit>
      <LimitExcept GET POST OPTIONS>
          Order deny,allow
          Deny from all
      </LimitExcept>
  </Directory>

  Binding-time: configuration is processed at start-up time
Mapping: Transformational View


  Problem space
    • domain concepts captured by domain-specific language
  Specification
    • DSL program
  Solution space
    • implementation language
    • components/libraries (‘run-time system’)
  Mapping
    • transformation from DSL to implementation language
Configuration vs Transformation




    • Two views on mappings provide different perspectives
    • Feature configuration defines a DSL with components as
      implementation language
Combining Mappings


                                       chaining




         multiple problem spaces                      multiple solution spaces




          alternative problem spaces              alternative solution spaces
Combining Mappings


                                                  language
                             text search
                                                  definition




                               regexp


                         automaton     embed


                   DFA                          SDF


                                           sdf2pp sdf2sig      pgen


               codegen      pp table           signature        SLR(0) table


                                                                       parse


            code                                                      sglr
Realizing Generative Software Development




  Requires techniques/technologies for creating
    • Domain-specific languages
    • Mappings
    • Solution components
Realizing Domain-Specific Languages




  Domain-specific languages come in many shapes and forms
    • Textual languages
    • Embedded in a programming language (MetaBorg)
    • Graphical languages
    • Wizards, GUIs
Realizing Mappings


  Product line configurators
    • map configuration file + components to system
  Generators, implemented using
    • Template and frame processors
    • Transformation systems
    • Multi-staged programming
    • Program specialization
    • Built-in meta-programming facility
  Interpreters
    • run-time interpretation of DSL program
Realizing Solution Space




    • Functions or classes
    • Generic components
    • Component models (JavaBeans, ActiveX, Corba)
    • Aspect-oriented programming (AspectJ)
Combining Techniques


  Generative software development can be realized using various
  combinations of techniques

  Example scenario:
    • Textual embedded language
    • ‘Assimilation’ by program transformation
    • Library for basic functionality of target programs
  Example scenario:
    • Graphical model language
    • Graph transformations to map to aspect-oriented programs
    • Aspects ‘inject’ code from model into base application
Relation To Other Fields
            Problem Space        Configuration Knowledge         Solution Space




                               System Families, Product Lines
        




                  Feature modeling, feature interactions
        




                                                                 Components
        
        
        
        
        
        !
        




                                  Generators/Transformers
        ¨
        




                                                                Architectures
        
        




            Domain-specific languages
        
        
        
        
        
        
        
        ©




                                            Aspect-oriented programming
        ¨
        §




              Aspect-oriented modeling
        ¦
        ¥
        ¥
        ¤
£




        ¢




                                                            Generic programming
        ¢
        ¢
        ¡
     




                                                                                60
Assimilation of Embedded Languages

  Embedding domain-specific languages
    • Extend language with syntax for application domain
  Examples
    • Java + Swing Userinterface Language: Expressions reflect
      hierarchy of Swing GUI objects
    • Java + RegExps: Compile-time syntactic checks of regular
      expressions, string rewrite rules
    • Java + Java: Java programs that generate Java programs
  Assimilation
    • Meld embedded DSL code with host code
    • Often requires local-to-global transformations
Assimilation of Embedded Languages

  Embedding domain-specific languages
    • Extend language with syntax for application domain
                    Concrete syntax for objects
  Examples
                        syntactic abstractions for libraries (APIs)
    • Java + Swing Userinterface Language: Expressions reflect
                        transformations to assimilate (and optimize)
      hierarchy of Swing GUI objects
    • Java + RegExps: Compile-time syntactic checks of regular
      expressions, string rewrite rules
    • Java + Java: Java programs that generate Java programs
  Assimilation
    • Meld embedded DSL code with host code
    • Often requires local-to-global transformations
Assimilation of Embedded Languages

  Embedding domain-specific languages
    • Extend language with syntax for application domain
                    local to global transformation
  Examples
                         generation of event handler class
    • Java + Swing Userinterface regexp compiles
                         caching of Language: Expressions reflect
      hierarchy of Swing GUI objects
                      adding class variable declarations
    • Java + RegExps: Compile-time syntactic checks of regular
      expressions, string rewrite rules
    • Java + Java: Java programs that generate Java programs
  Assimilation
    • Meld embedded DSL code with host code
    • Often requires local-to-global transformations
Example: Embedding Regular Expressions


   re   := str | alpha | re1 |re2 | re1 re2 | re* | re+
    e   := /re/ e | /re;f / x
    t   := regexp                                          regexps


  /re/e tests whether regular expression re matches value of e
Example: Embedding Regular Expressions


   re   := str | alpha | re1 |re2 | re1 re2 | re* | re+
    e   := /re/ e | /re;f / x
    t   := regexp                                          regexps


  /re/e tests whether regular expression re matches value of e

  function isEmail(x : string) : int
  begin
    return / alpha+ @ (alpha+ .)+ alpha+ / x;
  end
Example: Embedding Regular Expressions


   re   := str | alpha | re1 |re2 | re1 re2 | re* | re+
    e   := /re/ e | /re;f / x
    t   := regexp                                           regexps


  /re/e tests whether regular expression re matches value of e

  function isEmail(x : string) : int
  begin
    return / alpha+ @ (alpha+ .)+ alpha+ / x;
  end

  /re;f/e tests if regular expression re matches a prefix of e, and
  the suffix satisfies predicate f
Assimilating Regular Expression Matching



   function match(x : string) : int
     / (a | b) c / x;




   Desugar =
     ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
Assimilating Regular Expression Matching



   function match(x : string) : int
     / (a | b) c / x;

                             Rewrite rule
                                    L : t1 - t2 where s
                                    replace fragment matching t1 with t2
   Desugar =
     ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef

   ReMch :
     |[ /re/ e ]| -
     |[ begin
          var x : string; x := e;
          return /re; isEmpty/ x;
        end ]|
     where new = x
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return / (a | b) c; isEmpty / z;
   end




   Desugar =
     ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef

   ReMch :
     |[ /re/ e ]| -
     |[ begin
          var x : string; x := e;
          return /re; isEmpty/ x;
        end ]|
     where new = x
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return / (a | b) c; isEmpty / z;
   end




   ReSeq :
     |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]|
     where new = g
         ; add-def(||[
             function g(a : string) : int /re2; f/ a;
           ]|)

   add-def(|def) =
     rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
Assimilating Regular Expression Matching
                    Dynamic rules
                         rules( L : t1 - t2 )
                         defines new rewrite rule
                         inherits variable bindings from definition context
   function match(x : string) : int
   begin
     var z : string; z := x; return / (a | b) c; isEmpty / z;
   end

     AddDef :
     |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]|
   ReSeq :
     |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]|
     where new = g
         ; add-def(||[
             function g(a : string) : int /re2; f/ a;
           ]|)

   add-def(|def) =
     rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return / (a | b) ; k / z;
   end

     AddDef :
     |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]|
   ReSeq :
     |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]|
     where new = g
         ; add-def(||[
             function g(a : string) : int /re2; f/ a;
           ]|)

   add-def(|def) =
     rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return / (a | b) ; k / z;
   end




   ReAlt :
     |[ / (re1 | re2) ; f / x ]| - |[ (/re1;f/x) | (/re2;f/x) ]|
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return (/ a ; k / z) | (/ b ; k / z);
   end




   ReAlt :
     |[ / (re1 | re2) ; f / x ]| - |[ (/re1;f/x) | (/re2;f/x) ]|
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x; return (/ a ; k / z) | (/ b ; k / z);
   end




   ReStr :
     |[ /str ; f/ x ]| - |[ isPref(str, x)  f(getSuf(str, x)) ]|
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x;
     return (isPref(a,z)  k(getSuf(a,z)))
          | (isPref(b,z)  k(getSuf(b,z)))
   end

   ReStr :
     |[ /str ; f/ x ]| - |[ isPref(str, x)  f(getSuf(str, x)) ]|
Assimilating Regular Expression Matching



   function match(x : string) : int
   begin
     var z : string; z := x;
     return (isPref(a,z)  k(getSuf(a,z)))
          | (isPref(b,z)  k(getSuf(b,z)))
   endAddDef :
      |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]|
   Desugar =
     ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
Assimilating Regular Expression Matching

   function k(a : string) : int
   begin
     return /c; isEmpty/ a;
   end
   function match(x : string) : int
   begin
     var z : string; z := x
     return (isPref(a,z)  k(getSuf(a,z)))
          | (isPref(b,z)  k(getSuf(b,z)))
   endAddDef :
      |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]|
   Desugar =
     ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
Assimilating Regular Expression Matching

   function k(a : string) : int
   begin
     return /c; isEmpty/ a;
   end
   function match(x : string) : int
   begin
     var z : string; z := x
     return (isPref(a,z)  k(getSuf(a,z)))
          | (isPref(b,z)  k(getSuf(b,z)))
   end

   ReStr :
     |[ /str ; f/ x ]| - |[ isPref(str, x)  f(getSuf(str, x)) ]|
Assimilating Regular Expression Matching

   function k(a : string) : int
   begin
     return isPref(c, a)  isEmpty(getSuf(c, a));
   end
   function match(x : string) : int
   begin
     var z : string; z := x
     return (isPref(a,z)  k(getSuf(a,z)))
          | (isPref(b,z)  k(getSuf(b,z)))
   end

   ReStr :
     |[ /str ; f/ x ]| - |[ isPref(str, x)  f(getSuf(str, x)) ]|
Risks of Domain-Specific Languages

    • Design and implementation effort
        • implementing complete toolset for language is major effort
    • Documentation
        • tutorials, reference manual, implementation documentation
    • Training
        • need programmers that are skilled in using the language
    • Maintenance
        • of the language
        • of DSL programs
    • How does it fit in the existing work flow
        • tool chain
    • DSLs need abstraction/modularity features too
        • DSL programs become large; reuse of parts needed
Conclusion

  Summary
    • Generative software development is encapsulation of domain
      knowledge in generators and target components
    • Domain-specific languages are the interface to this knowledge
    • DSL programs can be seen as a configuration for the ‘solution
      space’ components
  Challenges
    • Finding good formalizations and encapsulations of new
      application domains
    • A platform for cheap construction of DSLs and generators
    • Integration of generators in workflow/toolchain
References
    • K. Czarnecki. Overview of Generative Software Development.
      In J.-P. Bantre et al. (Eds.): Unconventional Programming
      Paradigms (UPP) 2004, Mont Saint-Michel, France, LNCS 3566,
      pp. 313-328, 2005
    • D. Batory. Feature Models, Grammars, and Propositional
      Formulas. In H. Obbink and K. Pohl (Eds.) SPLC 2005. LNCS
      3714, pp. 7–20, 2005
    • M. Bravenboer and E. Visser. Concrete Syntax for Objects.
      Domain-Specific Language Embedding and Assimilation
      without Restrictions. In D. C. Schmidt, editor, Proceedings of the
      19th ACM SIGPLAN Conference on Object-Oriented Programing,
      Systems, Languages, and Applications (OOPSLA’04), pages
      365–383, Vancouver, Canada, October 2004. ACM Press.
    • E. Visser. Transformations for Abstractions. In J. Krinke and G.
      Antoniol, editors, Fifth IEEE International Workshop on Source
      Code Analysis and Manipulation (SCAM’05), Budapest, Hungary,
      October 2005. IEEE Computer Society Press. (Keynote paper)
Further Studying




  At Master Program Software Technology; Universiteit Utrecht
    • Seminar on Software Generation and Configuration
    • Master course on Program Transformation

More Related Content

What's hot

Verilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
Verilog Ams Used In Top Down Methodology For Wireless Integrated CircuitsVerilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
Verilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
Régis SANTONJA
 

What's hot (20)

HDL (hardware description language) presentation
HDL (hardware description language) presentationHDL (hardware description language) presentation
HDL (hardware description language) presentation
 
Hdl
HdlHdl
Hdl
 
Overview of digital design with Verilog HDL
Overview of digital design with Verilog HDLOverview of digital design with Verilog HDL
Overview of digital design with Verilog HDL
 
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
Efficient and Advanced Omniscient Debugging for xDSMLs (SLE 2015)
 
Verilog
VerilogVerilog
Verilog
 
Hardware description languages
Hardware description languagesHardware description languages
Hardware description languages
 
PL-4048, Adapting languages for parallel processing on GPUs, by Neil Henning
PL-4048, Adapting languages for parallel processing on GPUs, by Neil HenningPL-4048, Adapting languages for parallel processing on GPUs, by Neil Henning
PL-4048, Adapting languages for parallel processing on GPUs, by Neil Henning
 
D11: a high-performance, protocol-optional, transport-optional, window system...
D11: a high-performance, protocol-optional, transport-optional, window system...D11: a high-performance, protocol-optional, transport-optional, window system...
D11: a high-performance, protocol-optional, transport-optional, window system...
 
Csci360 08-subprograms
Csci360 08-subprogramsCsci360 08-subprograms
Csci360 08-subprograms
 
Verilog Lecture1
Verilog Lecture1Verilog Lecture1
Verilog Lecture1
 
08 subprograms
08 subprograms08 subprograms
08 subprograms
 
Verilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
Verilog Ams Used In Top Down Methodology For Wireless Integrated CircuitsVerilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
Verilog Ams Used In Top Down Methodology For Wireless Integrated Circuits
 
OpenGL Based Testing Tool Architecture for Exascale Computing
OpenGL Based Testing Tool Architecture for Exascale ComputingOpenGL Based Testing Tool Architecture for Exascale Computing
OpenGL Based Testing Tool Architecture for Exascale Computing
 
Python for IoT
Python for IoTPython for IoT
Python for IoT
 
Subprogram
SubprogramSubprogram
Subprogram
 
9 subprograms
9 subprograms9 subprograms
9 subprograms
 
Hpg2011 papers kazakov
Hpg2011 papers kazakovHpg2011 papers kazakov
Hpg2011 papers kazakov
 
system verilog
system verilogsystem verilog
system verilog
 
CSEG1001 Lecture 1 Introduction to Computers
CSEG1001 Lecture 1 Introduction to ComputersCSEG1001 Lecture 1 Introduction to Computers
CSEG1001 Lecture 1 Introduction to Computers
 
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA  by Ben Sanders, AMDBolt C++ Standard Template Libary for HSA  by Ben Sanders, AMD
Bolt C++ Standard Template Libary for HSA by Ben Sanders, AMD
 

Viewers also liked

Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
Reggie Meisler
 
Generative programming (mostly parser generation)
Generative programming (mostly parser generation)Generative programming (mostly parser generation)
Generative programming (mostly parser generation)
Ralf Laemmel
 
Transformational-Generative Grammar
Transformational-Generative GrammarTransformational-Generative Grammar
Transformational-Generative Grammar
Ruth Ann Llego
 
Ubiquitous Computing
Ubiquitous ComputingUbiquitous Computing
Ubiquitous Computing
u065932
 

Viewers also liked (14)

Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSeeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
 
Generative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programmingGenerative Programming In The Large - Applied C++ meta-programming
Generative Programming In The Large - Applied C++ meta-programming
 
Practical Meta Programming
Practical Meta ProgrammingPractical Meta Programming
Practical Meta Programming
 
A Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing SystemsA Generative Programming Approach to Developing Pervasive Computing Systems
A Generative Programming Approach to Developing Pervasive Computing Systems
 
Generative programming (mostly parser generation)
Generative programming (mostly parser generation)Generative programming (mostly parser generation)
Generative programming (mostly parser generation)
 
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel ComputingGenerative and Meta-Programming - Modern C++ Design for Parallel Computing
Generative and Meta-Programming - Modern C++ Design for Parallel Computing
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
 
Japanese Open and Generative Design
Japanese Open and Generative DesignJapanese Open and Generative Design
Japanese Open and Generative Design
 
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk PemulaSeri Belajar Mandiri - Pemrograman C# Untuk Pemula
Seri Belajar Mandiri - Pemrograman C# Untuk Pemula
 
Probabilistic programming
Probabilistic programmingProbabilistic programming
Probabilistic programming
 
Summary - Transformational-Generative Theory
Summary - Transformational-Generative TheorySummary - Transformational-Generative Theory
Summary - Transformational-Generative Theory
 
Transformational-Generative Grammar
Transformational-Generative GrammarTransformational-Generative Grammar
Transformational-Generative Grammar
 
Deep structure and surface structure
Deep structure and surface structureDeep structure and surface structure
Deep structure and surface structure
 
Ubiquitous Computing
Ubiquitous ComputingUbiquitous Computing
Ubiquitous Computing
 

Similar to Generative Software Development. Overview and Examples

7 - Architetture Software - Software product line
7 - Architetture Software - Software product line7 - Architetture Software - Software product line
7 - Architetture Software - Software product line
Majong DevJfu
 
Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02
Atv Reddy
 
Methodologies and flows for chip design
Methodologies and flows for chip designMethodologies and flows for chip design
Methodologies and flows for chip design
Derek Pappas
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
Dmytro Mindra
 

Similar to Generative Software Development. Overview and Examples (20)

computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...computer-science_engineering_principles-of-programming-languages_introduction...
computer-science_engineering_principles-of-programming-languages_introduction...
 
David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 
.Net programming with C#
.Net programming with C#.Net programming with C#
.Net programming with C#
 
Domain specific modelling (DSM)
Domain specific modelling (DSM)Domain specific modelling (DSM)
Domain specific modelling (DSM)
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
Net framework
Net frameworkNet framework
Net framework
 
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic Patterns
 
7 - Architetture Software - Software product line
7 - Architetture Software - Software product line7 - Architetture Software - Software product line
7 - Architetture Software - Software product line
 
Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02
 
Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02Embedded 100912065920-phpapp02
Embedded 100912065920-phpapp02
 
KeithJohnston06212015
KeithJohnston06212015KeithJohnston06212015
KeithJohnston06212015
 
Lecture3
Lecture3Lecture3
Lecture3
 
Ontimize Application Framework
Ontimize Application FrameworkOntimize Application Framework
Ontimize Application Framework
 
The Role of the Software Architect (short version)
The Role of the Software Architect (short version)The Role of the Software Architect (short version)
The Role of the Software Architect (short version)
 
C++ programming Assignment Help
C++ programming Assignment HelpC++ programming Assignment Help
C++ programming Assignment Help
 
Methodologies and flows for chip design
Methodologies and flows for chip designMethodologies and flows for chip design
Methodologies and flows for chip design
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 

More from Eelco Visser

Declarative Type System Specification with Statix
Declarative Type System Specification with StatixDeclarative Type System Specification with Statix
Declarative Type System Specification with Statix
Eelco 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
 

Recently uploaded

Recently uploaded (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Generative Software Development. Overview and Examples

  • 1. Generative Software Development overview and examples Eelco Visser visser@acm.org Universiteit Utrecht, Faculty of Science, Department of Information and Computing Sciences, Center for Software Technology October 27, 2005
  • 2. Generative Software Development Generative software development is a system-family approach, which focuses on automating the creation of system-family members: a given system can be automatically generated from a specification written in one or more domain-specific languages. K. Czarnecki. Overview of Generative Software Development. In J.-P. Bantre et al. (Eds.): Unconventional Programming Paradigms (UPP) 2004, Mont Saint-Michel, France, LNCS 3566, pp. 313-328, 2005
  • 3. Outline • Software system families • Commonality and variability • Domain engineering and application engineering • Feature modeling • Domain-specific languages • Examples • Generative programming • Problem space • Solution space • Mapping • Realizing generative software development • Overview of techniques • Example: assimilating embedded DSLs • Risks • Summary
  • 4. Software System Families Current research and practical experience suggest that achieving significant progress with respect to software reuse requires a paradigm shift towards modeling and developing software system families rather than individual systems. Czarnecki 2005
  • 5. Examples of Software System Families • Compilers • program representation, parsing, code generation, ... • Web applications • processing http requests, session management • E-commerce systems • products, user accounts, payment • Office applications • text processing • Web browsers • html rendering • TV software
  • 6. System Family Engineering System-family engineering (product-line engineering) seeks to exploit the commonalities among systems from a given problem domain while managing the variabilities among them in a systematic way. Czarnecki 2005
  • 7. Commonality and Variability • E-commerce systems • Commonalities: products, user accounts, payment, ... • Variabilities: types of products, shipment methods, ... • Web applications • Commonalities: processing http requests, session management • Variabilities: application workflow, page layout, ... • Web browsers • Commonalities: render HTML • Variabilities: plugins for email, chatting, ...
  • 8. Commonality and Variability • Compilers • Commonalities: program representation, parsing, code generation, ... • Variabilities: syntax and semantics of language • Office applications • Commonalities: text processing • Variabilities: spellchecking, grammarchecking, ... • TV software • Commonalities: ? • Variabilities: ?
  • 9. System Family Engineering Process system family engineering = domain engineering + application engineering reusable assets Domain engineering Application engineering Domain analysis new requirements System requirements Domain design System derivation Domain implementation System tailoring
  • 10. Domain Engineering = Development for Reuse Development of reusable assets • Reusable components, generic architectures, documentation Software engineering process for a class of systems • Domain analysis • scope of family • identify commonalities and variabilities • Domain design • common architecture • plan creation of systems from reusable assets • Domain implementation • implementation of reusable assets
  • 11. Feature Modeling A method and notation to elicit and represent common and variable features of the systems in a system family • And: all subfeatures must be selected • Alternative: only one subfeature can be selected • Or: one or more can be selected • Mandatory: features that are required • Optional: features that are optional Additional information • constraints • binding times • default attribute values, default features • stakeholders, priorities, etc.
  • 12. Feature Modeling: Example e-shop payment taxCalculation shipping creditCard debitCard electronicCheque addressResolution country postalCode streetAddress
  • 13. Feature Modeling: Alternative Notations • Feature diagrams can be expressed as context-free grammars • Feature selection is sentence generated by the grammar e-shop : payment taxCalculation [shipping] payment : paymentMethod+ paymentMethod : creditCard | debitCard | electronicCheque taxCalculation : addressResolution addressResolution : country | postalCode | streetAddres • Expressivity of feature diagrams is restricted • Features and other constraints can be expressed by means of propositional formulae See also D. Batory. Feature Models, Grammars, and Propositional Formulas. In H. Obbink and K. Pohl (Eds.) SPLC 2005. LNCS 3714, pp. 7–20, 2005
  • 14. Application Engineering = Development with Reuse Build concrete applications using reusable assets • Requirements = delta of generic system requirements • System derivation: manual or automated construction of system from reusable assets Feedback to domain engineering • Refine and adapt requirements • Tailor reusable assets to application
  • 15. Features vs Software Modules Concrete features • map to individual components Crosscutting features • can be implemented using aspect-oriented techniques • Examples: logging, synchronization Abstract features • Also known as: non-functional requirements • map to configuration of components and/or aspects Grouping features • Also known as: variation points • map to common interface and plug-compatible components
  • 16. Generative Software Development Generative software development is a system-family approach, which focuses on automating the creation of system-family members: a given system can be automatically generated from a specification written in one or more domain-specific languages. Czarnecki 2005
  • 17. General Purpose Languages Expressivity of general purpose languages is restricted to • while(cond) { x = foo(y, z); } • variable binding: storing values • function calls: computing values • control-flow: combining and choosing computations This is a rather powerful and generic approach • any computation can be expressed (Turing completeness) • modularization facilities allow further abstraction But it does not match application domains very well
  • 18. Advantages of Domain-Specific Languages • Domain-specific abstractions • pre-defined abstractions for concepts in application domain • Domain-specific concrete syntax • natural notation for a domain • Domain-specific error checking • find and report errors based on domain knowledge and notation • Domain-specific optimizations • opportunities for optimizations based on domain knowledge • Domain-specific tool support • tools can be aware of domain
  • 19. Domain-Specific Languages: Examples Successful domain-specific languages exist for many domains • Numerical computation • Database queries • Text search and analysis • Symbolic computation • Document transformation • Workflow • ...
  • 20. Domain-Specific Languages: Arithmetic x = c * y + z • Notation and semantics based on long tradition in mathematics • General purpose language notation would require x = plus(times(c, y), z) x = z.plus(y.times(c)) x = c.times(y).plus(z) • Compiler knows a lot about arithmetic • optimizations (partial evaluation, strength reduction, ...) • automatic coercions (int to real) • exceptions
  • 22. Domain-Specific Languages: Matrix Computation A = c * B + C • Now the elements of the assignment are matrices • The expression ‘means’ for i = lb to ub do A[i] = c * B[i] + C[i]
  • 23. Domain-Specific Languages: Matrix Computation A = c * B + C • Now the elements of the assignment are matrices • The expression ‘means’ for i = lb to ub do A[i] = c * B[i] + C[i] • General-purpose languages (C, C++, Java, ...) don’t understand matrices • ‘Mathematical’ languages such as Matlab and Octave do • Matrix notation allows • concise programs • compiler may apply optimizations
  • 24. Domain-Specific Languages: Database Queries SELECT NAME FROM ORDERS, INCLUDES, SUPPLIES WHERE CUST = ’Chaudron’ AND ORDERS.O# = INCLUDUES.O# AND INCLUDES.ITEM = SUPPLIES.ITEM • SQL: notation for querying relational databases • Abstracts from physical data structures of database • Based on small set of relational algebra operators • Allows efficient implementation of queries • Queries can be checked against database schema
  • 25. Domain-Specific Languages: Regular Expressions ^([a-z]+)/([A-Z][^/]+)/(.*) • A regular expression describes or matches a set of strings, according to certain syntax rules • Used by many text editors and utilities to search and manipulate bodies of text based on certain patterns. • Many programming languages support regular expressions for string manipulation. • Notation abstracts from underlying finite automata
  • 26. Domain-Specific Languages: Context-free Grammars <postal-address> ::= <name-part> <street-address> <zip-part> <personal-part> ::= <first-name> | <initial> "." <name-part> ::= <personal-part> <last-name> [<jr-part>] <EOL> | <personal-part> <name-part> <street-address> ::= [<apt>] <house-num> <street-name> <EOL> <zip-part> ::= <town-name> "," <state-code> <ZIP-code> <EOL> • Describes syntax of a formal language • Used to derive parsers that automatically recognize texts • Writing parsers manually is complex and error-prone
  • 27. Domain-Specific Languages: Rewrite Systems |[ if 0 then s1 else s2 ]| -> |[ s2 ]| |[ i + j ]| -> |[ k ]| where <add>(i,j) => k • Rewrite rule replaces a matching term with another term • Exhaustive application of rules reduces term to normal form • Applications: symbolic computation, program transformation,
  • 28. Domain-Specific Languages: Path Queries /bookstore/book[price>35]/title • XPATH path queries address parts of an XML document • used in document transformation with XSLT
  • 30. Domain-Specific Languages: Observations • Domain-specific languages are everywhere • DSL are sucessful when they cover a well-defined domain and are based on solid foundations • DSLs typically do not cover entire systems, but rather well-defined parts/aspects of systems
  • 31. Generative Software Development Generative software development is a system-family approach, which focuses on automating the creation of system-family members: a given system can be automatically generated from a specification written in one or more domain-specific languages. Czarnecki 2005
  • 32. Generative Programming: Mapping Problems to Solutions mapping Problem space Solution space Problem Space • Set of domain specific abstractions • Used to specify desired system family member Solution Space • Implementation oriented abstractions • Can be instantiated to implement domain abstractions
  • 33. Problem Space and Solution Space: Example Problem Space • Regular expressions Solution Space • Finite automata • Expressed as transition table in code Mapping • Lexical analyzer generator (flex)
  • 34. Mapping: Configuration View Problem space • domain-specific concepts and their features • constraints: illegal feature combinations, default settings, default dependencies Specification • selection of features for a specific system Solution space • implementation components, composed to create system Mapping • feature configuration mapped to component configuration • mapping defined by construction rules and optimizations Separation of spaces allows freedom of implementation
  • 35. Configuration Example: Apache’s httpd.conf Software composition LoadModule file_cache_module modules/mod_file_cache.so LoadModule mem_cache_module modules/mod_mem_cache.so LoadModule cgi_module modules/mod_cgi.so Configuration settings <Directory /home/*/public_html> AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS> Order deny,allow Deny from all </LimitExcept> </Directory> Binding-time: configuration is processed at start-up time
  • 36. Mapping: Transformational View Problem space • domain concepts captured by domain-specific language Specification • DSL program Solution space • implementation language • components/libraries (‘run-time system’) Mapping • transformation from DSL to implementation language
  • 37. Configuration vs Transformation • Two views on mappings provide different perspectives • Feature configuration defines a DSL with components as implementation language
  • 38. Combining Mappings chaining multiple problem spaces multiple solution spaces alternative problem spaces alternative solution spaces
  • 39. Combining Mappings language text search definition regexp automaton embed DFA SDF sdf2pp sdf2sig pgen codegen pp table signature SLR(0) table parse code sglr
  • 40. Realizing Generative Software Development Requires techniques/technologies for creating • Domain-specific languages • Mappings • Solution components
  • 41. Realizing Domain-Specific Languages Domain-specific languages come in many shapes and forms • Textual languages • Embedded in a programming language (MetaBorg) • Graphical languages • Wizards, GUIs
  • 42. Realizing Mappings Product line configurators • map configuration file + components to system Generators, implemented using • Template and frame processors • Transformation systems • Multi-staged programming • Program specialization • Built-in meta-programming facility Interpreters • run-time interpretation of DSL program
  • 43. Realizing Solution Space • Functions or classes • Generic components • Component models (JavaBeans, ActiveX, Corba) • Aspect-oriented programming (AspectJ)
  • 44. Combining Techniques Generative software development can be realized using various combinations of techniques Example scenario: • Textual embedded language • ‘Assimilation’ by program transformation • Library for basic functionality of target programs Example scenario: • Graphical model language • Graph transformations to map to aspect-oriented programs • Aspects ‘inject’ code from model into base application
  • 45. Relation To Other Fields Problem Space Configuration Knowledge Solution Space System Families, Product Lines Feature modeling, feature interactions Components ! Generators/Transformers ¨ Architectures Domain-specific languages © Aspect-oriented programming ¨ § Aspect-oriented modeling ¦ ¥ ¥ ¤ £ ¢ Generic programming ¢ ¢ ¡   60
  • 46. Assimilation of Embedded Languages Embedding domain-specific languages • Extend language with syntax for application domain Examples • Java + Swing Userinterface Language: Expressions reflect hierarchy of Swing GUI objects • Java + RegExps: Compile-time syntactic checks of regular expressions, string rewrite rules • Java + Java: Java programs that generate Java programs Assimilation • Meld embedded DSL code with host code • Often requires local-to-global transformations
  • 47. Assimilation of Embedded Languages Embedding domain-specific languages • Extend language with syntax for application domain Concrete syntax for objects Examples syntactic abstractions for libraries (APIs) • Java + Swing Userinterface Language: Expressions reflect transformations to assimilate (and optimize) hierarchy of Swing GUI objects • Java + RegExps: Compile-time syntactic checks of regular expressions, string rewrite rules • Java + Java: Java programs that generate Java programs Assimilation • Meld embedded DSL code with host code • Often requires local-to-global transformations
  • 48. Assimilation of Embedded Languages Embedding domain-specific languages • Extend language with syntax for application domain local to global transformation Examples generation of event handler class • Java + Swing Userinterface regexp compiles caching of Language: Expressions reflect hierarchy of Swing GUI objects adding class variable declarations • Java + RegExps: Compile-time syntactic checks of regular expressions, string rewrite rules • Java + Java: Java programs that generate Java programs Assimilation • Meld embedded DSL code with host code • Often requires local-to-global transformations
  • 49. Example: Embedding Regular Expressions re := str | alpha | re1 |re2 | re1 re2 | re* | re+ e := /re/ e | /re;f / x t := regexp regexps /re/e tests whether regular expression re matches value of e
  • 50. Example: Embedding Regular Expressions re := str | alpha | re1 |re2 | re1 re2 | re* | re+ e := /re/ e | /re;f / x t := regexp regexps /re/e tests whether regular expression re matches value of e function isEmail(x : string) : int begin return / alpha+ @ (alpha+ .)+ alpha+ / x; end
  • 51. Example: Embedding Regular Expressions re := str | alpha | re1 |re2 | re1 re2 | re* | re+ e := /re/ e | /re;f / x t := regexp regexps /re/e tests whether regular expression re matches value of e function isEmail(x : string) : int begin return / alpha+ @ (alpha+ .)+ alpha+ / x; end /re;f/e tests if regular expression re matches a prefix of e, and the suffix satisfies predicate f
  • 52. Assimilating Regular Expression Matching function match(x : string) : int / (a | b) c / x; Desugar = ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
  • 53. Assimilating Regular Expression Matching function match(x : string) : int / (a | b) c / x; Rewrite rule L : t1 - t2 where s replace fragment matching t1 with t2 Desugar = ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef ReMch : |[ /re/ e ]| - |[ begin var x : string; x := e; return /re; isEmpty/ x; end ]| where new = x
  • 54. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return / (a | b) c; isEmpty / z; end Desugar = ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef ReMch : |[ /re/ e ]| - |[ begin var x : string; x := e; return /re; isEmpty/ x; end ]| where new = x
  • 55. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return / (a | b) c; isEmpty / z; end ReSeq : |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]| where new = g ; add-def(||[ function g(a : string) : int /re2; f/ a; ]|) add-def(|def) = rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
  • 56. Assimilating Regular Expression Matching Dynamic rules rules( L : t1 - t2 ) defines new rewrite rule inherits variable bindings from definition context function match(x : string) : int begin var z : string; z := x; return / (a | b) c; isEmpty / z; end AddDef : |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]| ReSeq : |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]| where new = g ; add-def(||[ function g(a : string) : int /re2; f/ a; ]|) add-def(|def) = rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
  • 57. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return / (a | b) ; k / z; end AddDef : |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]| ReSeq : |[ /re1 re2 ; f/ x ]| - |[ /re1 ; g/ x ]| where new = g ; add-def(||[ function g(a : string) : int /re2; f/ a; ]|) add-def(|def) = rules( AddDef :+ |[ def* ]| - |[ def def* ]| )
  • 58. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return / (a | b) ; k / z; end ReAlt : |[ / (re1 | re2) ; f / x ]| - |[ (/re1;f/x) | (/re2;f/x) ]|
  • 59. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return (/ a ; k / z) | (/ b ; k / z); end ReAlt : |[ / (re1 | re2) ; f / x ]| - |[ (/re1;f/x) | (/re2;f/x) ]|
  • 60. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return (/ a ; k / z) | (/ b ; k / z); end ReStr : |[ /str ; f/ x ]| - |[ isPref(str, x) f(getSuf(str, x)) ]|
  • 61. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return (isPref(a,z) k(getSuf(a,z))) | (isPref(b,z) k(getSuf(b,z))) end ReStr : |[ /str ; f/ x ]| - |[ isPref(str, x) f(getSuf(str, x)) ]|
  • 62. Assimilating Regular Expression Matching function match(x : string) : int begin var z : string; z := x; return (isPref(a,z) k(getSuf(a,z))) | (isPref(b,z) k(getSuf(b,z))) endAddDef : |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]| Desugar = ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
  • 63. Assimilating Regular Expression Matching function k(a : string) : int begin return /c; isEmpty/ a; end function match(x : string) : int begin var z : string; z := x return (isPref(a,z) k(getSuf(a,z))) | (isPref(b,z) k(getSuf(b,z))) endAddDef : |[ def* ]| - |[ function k(a : string) : int /c; isEmpty/ a; def* ]| Desugar = ReMch + ReStr + ReAlt + ReSeq + ReKle + once-AddDef
  • 64. Assimilating Regular Expression Matching function k(a : string) : int begin return /c; isEmpty/ a; end function match(x : string) : int begin var z : string; z := x return (isPref(a,z) k(getSuf(a,z))) | (isPref(b,z) k(getSuf(b,z))) end ReStr : |[ /str ; f/ x ]| - |[ isPref(str, x) f(getSuf(str, x)) ]|
  • 65. Assimilating Regular Expression Matching function k(a : string) : int begin return isPref(c, a) isEmpty(getSuf(c, a)); end function match(x : string) : int begin var z : string; z := x return (isPref(a,z) k(getSuf(a,z))) | (isPref(b,z) k(getSuf(b,z))) end ReStr : |[ /str ; f/ x ]| - |[ isPref(str, x) f(getSuf(str, x)) ]|
  • 66. Risks of Domain-Specific Languages • Design and implementation effort • implementing complete toolset for language is major effort • Documentation • tutorials, reference manual, implementation documentation • Training • need programmers that are skilled in using the language • Maintenance • of the language • of DSL programs • How does it fit in the existing work flow • tool chain • DSLs need abstraction/modularity features too • DSL programs become large; reuse of parts needed
  • 67. Conclusion Summary • Generative software development is encapsulation of domain knowledge in generators and target components • Domain-specific languages are the interface to this knowledge • DSL programs can be seen as a configuration for the ‘solution space’ components Challenges • Finding good formalizations and encapsulations of new application domains • A platform for cheap construction of DSLs and generators • Integration of generators in workflow/toolchain
  • 68. References • K. Czarnecki. Overview of Generative Software Development. In J.-P. Bantre et al. (Eds.): Unconventional Programming Paradigms (UPP) 2004, Mont Saint-Michel, France, LNCS 3566, pp. 313-328, 2005 • D. Batory. Feature Models, Grammars, and Propositional Formulas. In H. Obbink and K. Pohl (Eds.) SPLC 2005. LNCS 3714, pp. 7–20, 2005 • M. Bravenboer and E. Visser. Concrete Syntax for Objects. Domain-Specific Language Embedding and Assimilation without Restrictions. In D. C. Schmidt, editor, Proceedings of the 19th ACM SIGPLAN Conference on Object-Oriented Programing, Systems, Languages, and Applications (OOPSLA’04), pages 365–383, Vancouver, Canada, October 2004. ACM Press. • E. Visser. Transformations for Abstractions. In J. Krinke and G. Antoniol, editors, Fifth IEEE International Workshop on Source Code Analysis and Manipulation (SCAM’05), Budapest, Hungary, October 2005. IEEE Computer Society Press. (Keynote paper)
  • 69. Further Studying At Master Program Software Technology; Universiteit Utrecht • Seminar on Software Generation and Configuration • Master course on Program Transformation