41
Introduction to Generative Software Development Krzysztof Czarnecki University of Waterloo [email protected] www.generative-programming.org

Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

  • Upload
    others

  • View
    18

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

Introduction toGenerative Software Development

Krzysztof CzarneckiUniversity of [email protected]

www.generative-programming.org

Page 2: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

2

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Goals

• What is to be achieved?• Basic understanding of Generative Programming (GP)• Based on first impressions and discussion you should

be able to judge what you can benefit from GP

• How can it be achieved?• Overview of the most important steps of GP• Demonstration of tools• Presentation of case studies• Discussion in the plenum

Page 3: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

3

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Overview

Challenges• Introduction• First Example• Further Information

Page 4: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

4

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Complexity

• Software systems are engineering in new and demanding application domains

• Software systems support increasingly complex tasks

• Requirements concerning functionality and efficiency are constantly growing

Page 5: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

5

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Quality

• Software is deployed in life-critical application areas

• Software malfunction causes economic losses

• Usability is a major acceptance criterion• Users expect a specific quality that is

determined by varying criteria

Page 6: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

6

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Productivity

• Growing demand for new systems and variants

• Increase of productivity and development staff cannot close the gap between demand and supply

• Standard software becomes more and more important, but it cannot be adapted to every specific requirement

Page 7: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

7

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Maintenance & Legacy Systems

• Long lifetime of software systems (sometimes 20 years and more)

• Software must be continuously adapted to new and changing requirements

• Maintenance of legacy systems absorbs development capacity to a high degree

• Software systems of today are the legacy of tomorrow!

Page 8: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

8

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Example "Object Technology"

• Theory• Productivity and quality should increase thanks to

reuse• Reality

• Classes are too small as units of reuse• Frameworks are sufficiently large as units of reuse,

but frameworks from different vendors do not integrate well

• Design patterns are pieces of reusable knowledge, but they do not exist as executable code

Page 9: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

9

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Example "Component Technology"

• Standards and platforms improve interoperability and the distributed execution of components

• Many components provide a special mode for customization

• Reusing small components does not have a large impact on software development while large components require high customization efforts

Page 10: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

10

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

One of the Causes ...

Currently dominating methods and tools are designed for developing single systems

Page 11: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

11

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Overview

• ChallengesIntroduction

• First Example• Further Information

Page 12: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

12

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Single System Development

• Focus on analyzing, modeling, and implementing a single system

• Important goal: decomposition into components, i.e. modularization• Individual components are easier to maintain,

to replace, and to reuse• But, what are the criteria for decomposition?

Page 13: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

13

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Experiment - Part I

Page 14: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

14

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Experiment - Part II

Page 15: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

15

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Exemplar Systems of a Family

Page 16: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

16

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

The "Right" Modules

Page 17: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

17

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

An Additional System …

Page 18: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

18

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

… Can Cause Surprise!

Page 19: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

19

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

How To Order Systems?

• By Components• Downward arrow on

top• Large triangle below

with its 90° angle at the lower left point

• …

• By Specification• A cat• Sitting upright• Waiving its tail

Page 20: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

20

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Creating the order• Expert language• Form, catalogue• By example Processing the order

• Completion• Validation• Construction rules• Optimization

Product generation• Assembling elementary,

reusable components

From Order To Product

Page 21: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

21

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Generative Software Development…

• is a software family approach• automates the creation of family members• generate a family member based on a

specification in a domain-specific language

Page 22: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

22

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Domain-Specific Languages (DSLs)

• Scoped and designed for a specific purpose• Domain-specific abstractions• Domain-specific concrete syntax• Domain-specific error checking• Domain-specific optimizations• Domain-specific debugging, version control, etc.

• Many forms possible• Text, diagrams, forms, tables, wizards, conventional

library, etc.

Page 23: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

23

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Different Forms of DSLs

page MainPage () {filename = index.html

placeHolders {header = fragmentCall { include = Header() }leftNavigation = fragmentCall { include = LeftNavigation(nil) } rightNavigation = fragmentCall { include = RightNavigation() }body = fragment { filename = main/main.html

filterElement = body }footer = fragmentCall { include = Footer () }

}}

Configuration tool

Visual DSLTextual DSL

Wizard

Library in aprogramming language

Page 24: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

24

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Two Processes

• Domain Engineering• Analysis: Domain scoping and defining a set of reusable,

configurable requirements for the systems in the domain• Design: Developing a common architecture for the systems in

the domain and devising a production plan• Implementation: Implementing the reusable assets, for

example, reusable components, domain-specific languages, generators, a reuse infrastructure, and a production process

• Application Engineering• Producing concrete systems using the reusable assets developed

during Domain Engineering.

Page 25: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

25

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

DomainAnalysis

DomainDesign

DomainImplementation

DomainModel

Architecture &Production Plan

DomainKnowledge

Product

RequirementsAnalysis

ProductConfiguration

Integrationand Test

ProductFeatures

ProductConfiguration

Customer Requirements

Domain Engineering Application Engineering

Components,DSLs,

Generators,Infrastructure

NewRequirements

System Family ApproachIte

rativ

e Pro

cess

Page 26: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

26

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Maturity Levels in Domain Engineering

• Domain Engineering can be applied at different levels• Domain analysis• Reference architectures and architectural patterns• Design patterns and OO frameworks• Components and component frameworks• Generation of parts of application code

• Generative Programming aims at the highest level of automation of application engineering• Domain-specific languages and automatic configuration of

components

Page 27: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

27

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker Problem Space

• Domain-specificabstractions

Solution Space• Implementation-

orientedabstractions

Mapping

Generative Domain Model

Specification Target platform

Page 28: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

28

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker Problem Space

• Domain-specificlanguage

Solution Space• Implementation

languageTransformation

Transformational View

Page 29: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

29

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker Problem Space

• Domain-specificconcepts and

• Features

Solution Space• Elementary

components• Maximum

combinability• Minimum

redundancy

Configuration Knowledge• Illegal feature combinations• Default settings• Default dependencies• Construction rules• Optimizations

Domain SpecificLanguage(s)

Generator(s) /product configurators

Components +Product-LineArchitecture

Configuration View

Also: Reflection, Object Factory, …

Page 30: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

30

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Views And Viewpoints

• System models are organized into multiple views• Different abstraction levels• Different parts of a system• Different aspects

• workflow, security, deployment

• Each view conforms to some viewpoint• Defines scope, notation,

process, validation• Each viewpoint is relevant to

some stakeholder

Page 31: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

31

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Mapping Constellations

Chaining of mappings

Multiple problem spaces Multiple solution spaces

Alternative problem spaces Alternative solution spaces

Page 32: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

32

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

• Each subdomainis implementedas a generative domain model

• Higher order components

Matrix types

Factorizationalgorithms

Containers

Matrixexpressions

Linearequationsolvers

Jim Neighbors, Draco, 1980

Domain Network

Page 33: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

33

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

DSL

Components• elementary• generic• DSL

Generator

Concrete Components

Specification in DSL

DSL

Components• elementary• generic• DSL

Generator

Concrete Components

Specification in DSL

Federated Generators

Page 34: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

34

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

A Technology Projection ...

… is a mapping of the generative domain model onto • other software development paradigms,• a programming language, • several development tools that are combined

within one environment or on one platform

• Meanwhile, several technology projections are available

Page 35: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

35

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Existing Technology Projections

Problem Space• Domain-

specificconcepts and

• Features

Solution Space• Elementary

components• Maximum

combinability• Minimum

redundancy

Configuration Knowledge• Illegal feature

combinations• Default settings• Dependencies• Construction rules• Optimizations

C++Template meta-programmingStatic configurationLanguage-specificmeans only

Java and JavaBeansInteractive parameterization

of JavaBeansDynamic configurationLanguage-specific means only

Java und AspectJUsing an AspectWeaverStatic configurationSeparate preprocessing step

ANGIEEmployment of a frame processorStatic configurationSeparate preprocessing step

Small ComponentsUsage of an XML configuration fileStatic and dynamic configurationSeparate preprocessing step

XML, TL and Ada 83Graphically-interactiveconfigurationStatic configurationSeparate preprocessing step

Page 36: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

36

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Many Mapping Technologies to Chose From…

• Template-based code generation• TL, Velocity, XVCL, Angie, …

• Metaprogramming• C++ Template Metaprogramming, Template Haskell, …

• Transformation systems• DMS, Stratego/XT, TXL, …

• Program specialization• Tempo, …

• Model transformation• ATL, UMLAUT, …

• Product configurators• …

Page 37: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

37

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Generating Code From Domain Specific Languages

Application Code

Model

PlatformFrameworks

Generated Code

Model

Platform

(a)

(b)

Model

Application Code

PlatformFrameworks

Model

Generated Code

Platform

(c)

Model

Application CodeDomain Specific

FrameworkPlatform

Frameworks

Model

Generated CodeFramework

Pattern Language

Platform

(d)

PlatformFrameworks

Application Code

Model

Platform

Generated Code

Model

Application Code

Model

PlatformFrameworks

Generated Code

Model

Platform

(a)

Application Code

Model

PlatformFrameworks

Generated Code

Model

Platform

Application Code

Model

PlatformFrameworks

Generated Code

Model

Platform

(a)

(b)

Model

Application Code

PlatformFrameworks

Model

Generated Code

Platform

(b)

Model

Application Code

PlatformFrameworks

Model

Generated Code

Platform

Model

Application Code

PlatformFrameworks

Model

Generated Code

Platform

(c)

Model

Application CodeDomain Specific

FrameworkPlatform

Frameworks

Model

Generated CodeFramework

Pattern Language

Platform

(c)

Model

Application CodeDomain Specific

FrameworkPlatform

Frameworks

Model

Generated CodeFramework

Pattern Language

Platform

Model

Application CodeDomain Specific

FrameworkPlatform

Frameworks

Model

Generated CodeFramework

Pattern Language

Platform

(d)

PlatformFrameworks

Application Code

Model

Platform

Generated Code

Model

(d)

PlatformFrameworks

Application Code

Model

Platform

Generated Code

Model

PlatformFrameworks

Application Code

Model

Platform

Generated Code

Model

Slide by © 2004 Jack Greenfield

Page 38: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

38

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Essential Terms

In this presentation• Domain Analysis is part

of Domain Engineering• A product family

comprises the variants of a product

• A product line comprises multiple products that are targeted for a specific group of customers

• A product line can be based on system families

Different uses• Domain Analysis

precedes Domain Engineering

• Product family and product line are synonyms

Page 39: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

39

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Essential Terms

• Generic• "relating to or characteristic of a whole group or

class" (Merriam-Webster Online)• Solution space technique for developing

parameterizable components• Generative

• "having the power or function of generating, originating, producing, or reproducing" (Merriam-Webster Online)

• System for producing other systems; it comprises problem space, configuration knowledge, and solution space

Page 40: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

40

©19

99-2

002

K. C

zarn

ecki

& U

. Eis

enec

ker

Scope

• Generative programming can be applied at any level of granularity – from individual functions and classes to large software systems

• Generative programming is not limited to implementing application code, testing, and creating GUIs

• System family engineering also includes• documentation• system installation• user training• maintenance, and many more

Page 41: Introduction to Generative Software Developmentusers.encs.concordia.ca/~gregb/home/PDF/czarnecki-ECE750-Lecture1_Introduction1up.pdfIntroduction to Generative Software Development

And … Watch Out For These Cats!