generative programming & middleware farid hosseini reza azimi feb 6,2003 university of toronto

20
Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Upload: stephany-payne

Post on 27-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Generative programming &

MiddlewareFarid HosseiniReza Azimi

Feb 6,2003University of Toronto

Page 2: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Agenda,

Part 1 (by Farid Hosseini)

What is Generative Programming (GP) How GP Helps middleware Q/A

Part 2 (by Reza Azimi)

How Middleware Helps GP Q/A

Page 3: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

What is Generative Programming?

Page 4: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Status of Generative Programming (GP)

GP requires skills that are not mainstream.GP is not user-friendly.GP is not widely used.

Most Developers do not use GP as a design or implementation strategy.

(” ECOOP’2002 Workshop on Generative Programming”)

Page 5: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

What’s new in Generative Programming?

The current practice: Manually Searching for components Manually adapting components Manual assembly

Generative Programming, automatic selection and assembly of

components on demand.(Definition provided by K. Czarnecky )

Page 6: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

What does the Programmer do in GP?

The programmer states what s/he wants Modelling

The generator produces the desired system or component. Code generation

(K. Czarnecky )

Page 7: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Aspects of Generative Programming

representation of the problem domain

implementation of the solution domain

(” ECOOP’2002 Workshop on Generative Programming”)

Page 8: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Domain-Modelling & Code Generation

Three things are required: A modelling tool

To define what you want

A code generator To close the gap between the domain and

the code worlds

A component library. To facilitate the code generation

(”Application Development Advisor” Magazine)

Page 9: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

How is it possible?

Model+Generator +

Library of components

Code

GENERATOR Modellin

g

Element

s

Modellin

g

Element

s

Model

CodeCode

Aaa()Bbb()Ccc().Yyy()Zzz()

Aaa()Bbb()Ccc().Yyy()Zzz()

Page 10: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

How is it possible?

By direct mapping from each modeling element to the generation of a set of intentionally equivalent source code statements. When a library of components is available, the model interpreter can leverage a larger granularity of reuse by generating configurations of the available components.

(“Generating Aspect Code from Models” paper)

Page 11: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Templates and Generators

Templates are a user-friendly way to specify an implementation.

A templating component can be used by the code generator to emit source code.

This approach is language and domain model neutral.

(” ECOOP’2002 Workshop on Generative Programming”)

Page 12: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

A Pretty Template

public class Person {

//-for-each-field-//

private String mField = "";

public String getField() {

return mField;

}

public void setField( String pField ) {

mField = pField;

}

//-end-//

}

Page 13: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

How Middleware Helps Generative Programming?

Page 14: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Introduction

Our methodology of pursuing the interoperability of different models is established on the idea of Generative Programming (GP):

The generative automation of middleware for building the interoperability.

(Wei Zhao)

Page 15: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

How is it possible?

Model

GENERATOR

Modellin

g

Element

s

Modellin

g

Element

s

What are the Modelling Elements for a Middleware?

Page 16: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Middleware Elements

www.cs.wustl.edu/~schmidt/TAO.html

Thread Pools

SchedulingServiceStandard

Synchronizers

Portable Priorities

Protocol PropertiesExplicit Binding

Page 17: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Component Of The Shelf (COTS)Many hardware & software APIs and protocols are now standardized, e.g.:

• TCP/IP, ATM• POSIX & JVMs• CORBA ORBs & components

• Intel x86 & Power PC chipsets

• Ada, C, C++, RT Java

(Douglas C. Schmith)

Page 18: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Middleware Generator

(Douglas C. Schmith)

Page 19: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Middleware Generator at work

Common ORB + Assorted Tools

Common Semantic Representation

Plat1

Impl

•A Generated Middleware needs:•A common internal representation (ideally auto-generated) for each middleware specification •Based on generalizing the middleware semantics

Middleware Generator

2. Analyze the optimization rules & opportunities

3. Generate middleware that is customized for a particular platform & application use-case

•A generated implementation that is optimized automatically for each target platform & application use-case•Based on reflective assessment of platform descriptions & application use-case

Plat2

Plat2

.pd

Plat2

ImplPlat3

Impl

1. Read the target platform description & application requirements

Ap

plic

atio

n R

equ

irem

ents

CORBA/Java/COM+ Applications

Plat3

Plat3

.pd

Plat1

Plat1

.pd

(Douglas C. Schmith)

Page 20: Generative programming & Middleware Farid Hosseini Reza Azimi Feb 6,2003 University of Toronto

Q/A