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

Post on 27-Dec-2015

214 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Generative programming &

MiddlewareFarid HosseiniReza Azimi

Feb 6,2003University 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

What is Generative Programming?

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”)

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 )

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 )

Aspects of Generative Programming

representation of the problem domain

implementation of the solution domain

(” ECOOP’2002 Workshop on Generative Programming”)

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)

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()

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)

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”)

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-//

}

How Middleware Helps Generative Programming?

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)

How is it possible?

Model

GENERATOR

Modellin

g

Element

s

Modellin

g

Element

s

What are the Modelling Elements for a Middleware?

Middleware Elements

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

Thread Pools

SchedulingServiceStandard

Synchronizers

Portable Priorities

Protocol PropertiesExplicit Binding

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)

Middleware Generator

(Douglas C. Schmith)

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)

Q/A

top related