Generative Programming. Automated Assembly Lines.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Generative Programming and Active Libraries Krzysztof Czarnecki DaimlerChrysler Research and Technology Software Engineering Lab Ulm, Germany
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Unified theory of software evolution Reengineering – Business process reengineering and software reengineering BPR model – Business definition, process.
Marko Rosenmüller - University of Magdeburg, Germany 1 Feature-oriented Refactoring of Berkeley DB Dagstuhl Seminar on Software Engineering for Tailor-made.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
CStar Optimizing a C Compiler
Software Factory Assembling Applications with Models, Patterns, Frameworks and Tools Anna Liu Senior Architect Advisor Microsoft Australia.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
1 FM Overview of Adaptation. 2 FM RAPIDware: Component-Based Design of Adaptive and Dependable Middleware Project Investigators: Philip McKinley, Kurt.
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Domain-Specific Software Engineering Alex Adamec.
UML and Object Oriented Concepts
Deriving AO Software Architectures using the AO-ADL Tool Suite Luis Fernández, Lidia Fuentes, Mónica Pinto, Juan A. Valenzuela Universidad de Málaga
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
Software Engineering Muhammad Fahad Khan
Software Reuse Prof. Ian Sommerville
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 14Slide 1 Design with Reuse l Building software from reusable components.
5.3 Machine-Independent Compiler Features
Design Patterns.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
SPL: A Language and Compiler for DSP Algorithms Jianxin Xiong 1, Jeremy Johnson 2 Robert Johnson 3, David Padua 1 1 Computer Science, University of Illinois.
Software Product Families. Generative Programming Main text: Ian Sommerville, Software Engineering, 8 th edition, chapter 18 Additional readings: K. Czarnecki.
1 N Degrees of Separation: Multi-Dimensional Separation of Concern (MDSOC) HyperJ: language and concepts of general concern combination.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
A Survey of Rewriting Strategies in Program Transformation Systems Part 1 Author: Eelco Visser Speaker: Wei Zhao.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
MathCore Engineering AB Experts in Modeling & Simulation WTC.
1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
L8 - March 28, 2006copyright Thomas Pole , all rights reserved 1 Lecture 8: Software Asset Management and Text Ch. 5: Software Factories, (Review)
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
INRIA - LaBRICharles Consel Jan-06 1 Domain-Specific Software Engineering Charles Consel Phoenix Research Group LaBRI /INRIA-Futurs January 2006.
1 Code optimization “Code optimization refers to the techniques used by the compiler to improve the execution efficiency of the generated object code”
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Towards Multi-Paradigm Software Development Valentino Vranić Department of Computer Science and Engineering Faculty of Electrical Engineering.
University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,
© Siemens AG, CT SE 2 C O R P O R A T E T E C H N O L O G Y 1 Model-Driven Development for Pluggable Collaborations Iris Groher, Stephan Bleicher, Christa.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 18 Slide 1 Software Reuse.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
OOPSLA workshop on Domain-Specific Visual Languages 1 Juha-Pekka Tolvanen, Steven Kelly, Jeff Gray, Kalle Lyytinen.
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
The Interpreter Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Advanced Software Development Karl Lieberherr CSG 260 Fall Semester
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
2000 Research Overview Dr. Kim Mens Programming Technology Lab Vrije Universiteit Brussel.
CS412/413 Introduction to Compilers and Translators April 2, 1999 Lecture 24: Introduction to Optimization.
A Framework for Automated and Composable Testing of Component-based Services Miguel A. Jiménez, Ángela Villota, Norha M. Villegas, Gabriel Tamura, Laurence.
ECE 750 Topic 8 Meta-programming languages, systems, and applications Automatic Program Specialization for J ava – U. P. Schultz, J. L. Lawall, C. Consel.
Software Reuse. Objectives l To explain the benefits of software reuse and some reuse problems l To discuss several different ways to implement software.
Chapter 0: Introduction
Design Patterns: Brief Examples
Chapter 1 Introduction.
Object-Oriented Software Engineering Using UML, Patterns, and Java,
Software Reuse ©Ian Sommerville 2006.
Chapter 1 Introduction.
Object-Oriented Design
Object Oriented Design
Ponder policy toolkit Jovana Balkoski, Rashid Mijumbi
Presentation transcript:

Generative Programming

Automated Assembly Lines

Interchangeable Parts

Software Engineering Expectations Expectations –Master high complexity –Achieve high productivity and quality –Facilitate effective maintenance and evolution Current situations Current situations –Lag more than a century in development behind manufacturing –Be more like cottage industry handcrafting one-of-a-kind solutions than engineering

Generative Programming A software engineering paradigm on modeling software system families A software engineering paradigm on modeling software system families –Problem space: requirements specification –Solution space: customized and optimized product A direct consequence of the “automation assumption”: If you can compose components manually, you can also automate this process. A direct consequence of the “automation assumption”: If you can compose components manually, you can also automate this process.

Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing families of domain concepts Generative Programming also includes the process of creating concrete instances of concepts Generative Programming also includes the process of creating concrete instances of concepts

Overview Translator Generative Component Specification in a configuration DSL Implementation components Finished Configuration

Specification Levels UnspecificSpecific Client’s own format Direct format specification Precise format specification Format selected based on optimization flags Format selected based on default settings Storage

Why Generators? Raise the intentionality of system descriptions Raise the intentionality of system descriptions –E.g. using domain specific notation Produce an efficient implementation Produce an efficient implementation –Nontrivial mapping into implementation concepts Avoid the library scaling problem Avoid the library scaling problem –Library built as concrete component double in size for each new added feature

Transformation Model System Requirements Source Code (C++, Java) System Implementation High Level System Specification System Requirements compile Source Code (C++, Java) compile Source Code (C++, Java) Source in DSL System Implementation Source in DSL Manually implement Implement with tools

Type of transformations Vertical Vertical Horizontal Horizontal

Vertical Transformation Refines higher-level structure into lower level, preserving structure Refines higher-level structure into lower level, preserving structure Typical of step-wise refinement and CASE or GUI builders Typical of step-wise refinement and CASE or GUI builders

Horizontal Transformation Modifies modular structure at the same level Modifies modular structure at the same level Merges, deletes or modifies existing modules Merges, deletes or modifies existing modules

Kind of transformations Compiler transformations Compiler transformations Source to source transformations Source to source transformations

Compiler Transformations Refinements Refinements –Decomposition –Choice of representation –Choice of algorithm –Specialization –Concretization Optimizations Optimizations

Compiler Optimizations Inlining Inlining Constant folding Constant folding Data caching Data caching Loop fusion Loop fusion –Adding matrixes A+B+C Loop unrolling Loop unrolling –When number of iterations is small Code motion Code motion –Move invariant code outside of loop

Compiler Optimizations (2) Common subexpression elimination Common subexpression elimination Dead-code elimination Dead-code elimination Partial evaluation Partial evaluation –Partially evaluate a function based on knowledge of some of its parameters to be constants in a special context Finite differencing Finite differencing x = x + 2x = x + 2; y = x * 3;y = y + 6;

y = x * 3 dy/dx = 3 dx = 2 y i+1 = y i + 3 dx

Source to source Transformations Editing transformations Editing transformations Refactoring Refactoring Abstraction and generalization Abstraction and generalization Introducing new variant points Introducing new variant points Simplification Simplification

Implementation Technologies Generic Programming Generic Programming Metaprogramming Metaprogramming Static Metaprogramming in C++ Static Metaprogramming in C++ Reflection in C# Reflection in C# Aspect Oriented Programming Aspect Oriented Programming Generators Generators Runtime Code Generation in LINQ Runtime Code Generation in LINQ Intentional Programming Intentional Programming 20

Approaches Aspect-Oriented Programming Aspect-Oriented Programming Subject-Oriented Programming Subject-Oriented Programming Software Transformation Technologies Software Transformation Technologies Intentional Programming Intentional Programming Domain Engineering Domain Engineering Generative Programming Generative Programming

Aspect Oriented Programming To improve the modularity of designs and implementations by allowing a better encapsulation of cross-cutting concerns: To improve the modularity of designs and implementations by allowing a better encapsulation of cross-cutting concerns: –synchronization, distribution, authentication, data traversal, memory allocation, tracing, caching, etc. New kind of modularity called “aspect” New kind of modularity called “aspect” Aspects represent an orthogonal parameterization concept compared to what's available in current languages Aspects represent an orthogonal parameterization concept compared to what's available in current languages

Subject Oriented Programming Related to AOP Related to AOP Focuses on capturing different subjective perspectives on a single object model Focuses on capturing different subjective perspectives on a single object model It allows composing applications out of "subjects" (partial object models) by means of declarative composition rules It allows composing applications out of "subjects" (partial object models) by means of declarative composition rules

Software Transformations aid software development activities by providing mechanized support for manipulating program representations aid software development activities by providing mechanized support for manipulating program representations Examples: Examples: –extracting views –Refinement –Refactoring –optimizations of program representations

Intentional Programming an extendible programming environment based on transformation technology and direct manipulation of active program representations an extendible programming environment based on transformation technology and direct manipulation of active program representations New programming notations and transformations can be distributed and used as plug-ins New programming notations and transformations can be distributed and used as plug-ins The system replaces parsing technology with the direct entry and editing of resolved ASTs The system replaces parsing technology with the direct entry and editing of resolved ASTs

Domain Engineering Domain engineering comprises the development of a common model and concrete components, generators, and reuse infrastructures for a family of software systems Domain engineering comprises the development of a common model and concrete components, generators, and reuse infrastructures for a family of software systems

Goals of Generative Programming Each language implements its own libraries: types are hard to match Each language implements its own libraries: types are hard to match Problem: Problem: int add(int i, int j) { return i+j; } add(1, x); int inc(int x) { return add(1, x); } class Complex { double r, i; } Complex add(Complex x, Complex y) { return Complex(x.r + y.r, x.i + y.i); }

Complex inc(Complex x) { return add(Complex(1, 0), x); } Compiler can’t optimize, since it does not know the Complex type Compiler can’t optimize, since it does not know the Complex type Class used to represent concepts in domain, but semantics of domain is not conveyed to compiler Class used to represent concepts in domain, but semantics of domain is not conveyed to compiler

Partial Evaluation Matrix A, B, C, D; D = A.add(B.add(C)); Requires allocation of temporary intermediate matrix and two loops Compiler is not capable, DSL for algebra could incorporate, e.g. write Matrix.add(A, B, C);

C++ Using template metaprogramming one can produce specialized code Using template metaprogramming one can produce specialized code BLITZ matrix library: faster than Fortran BLITZ matrix library: faster than Fortran