200 likes | 301 Views
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.
E N D
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
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)
Model Templates Aaa() Bbb() Ccc() . Yyy() Zzz() Modelling Elements How is it possible? Model+ Generator + Library of components Code GENERATOR Code
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-// }
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? What are the Modelling Elements for a Middleware? Model GENERATOR Modelling Elements
Middleware Elements Scheduling Service Standard Synchronizers Thread Pools Protocol Properties Explicit Binding Portable Priorities www.cs.wustl.edu/~schmidt/TAO.html
Intel x86 & Power PC chipsets • TCP/IP, ATM • POSIX & JVMs • CORBA ORBs & components • Ada, C, C++, RT Java Component Of The Shelf (COTS) Many hardware & software APIs and protocols are now standardized, e.g.: (Douglas C. Schmith)
Middleware Generator (Douglas C. Schmith)
Application Requirements 3. Generate middleware that is customized for a particular platform & application use-case 2. Analyze the optimization rules & opportunities Middleware Generator Plat1 Plat2 Plat3 Plat1 .pd Plat2 .pd Plat3 .pd 1. Read the target platform description & application requirements Middleware Generator at work CORBA/Java/COM+ Applications • A Generated Middleware needs: • A common internal representation (ideally auto-generated) for each middleware specification • Based on generalizing the middleware semantics Common ORB + Assorted Tools • A generated implementation that is optimized automatically for each target platform & application use-case • Based on reflective assessment of platform descriptions & application use-case Common Semantic Representation Plat1 Impl Plat2 Impl Plat3 Impl (Douglas C. Schmith)