260 likes | 436 Views
EGL Online User Group: EGL Open Update. Tuesday, April 26, 2011. Evolution of Language Abstraction. Future. Many. Multiple Machine. One. EGL. Runtime Platform. Many. One. One. Java. One. Many. OS. One. Single Machine. One. C, COBOL. One. Many. Hardware. One. Assembler. One.
E N D
EGL Online User Group: EGL Open Update Tuesday, April 26, 2011
Evolution of Language Abstraction Future Many Multiple Machine One EGL Runtime Platform Many One One Java One Many OS One Single Machine One C, COBOL One Many Hardware One Assembler One Evolution of Execution Environment Evolution of Programming Languages Range of Deployment Options
EGL Basic Concepts • Various component types that programmers can define • Data Item – Creates a Type alias from extended data declaration • Record - aggregate of typed fields into new type • Program - Main program starts run unit – used for batch processing • Library – Static set of data and functions – local to run-unit • Service – Remotable set of functions • Interface – Abstract definition of a Service • Handler – Object-based component containing instance data and functions • ExternalType – Abstract type definition of a type implementation that exists outside of EGL • Annotations and Stereotypes • Meta data applied to program elements • Drives transformations as well as tooling • Abstract Statements meant to be extended • get, add, delete, replace, close, call, etc.
Extensible Abstractions - Metadata • Metadata allows concepts to be added without forcing specific implementations • Common semantics modeled, i.e. • CRUD operations on database • Remote Invocation • UI input validation • Same semantics can apply across runtimes and frameworks • Compiler/Generator maps semantic concepts to given runtime • Metadata supplies the specifics
Extensible Metadata – SQLRecord Example // A Record type definition mapped to a database table Record Order typeSQLRecord { tableNames = [“ORDER”], keyItems=[“orderID”] } orderID OrderID { columnName=“ORDERID” }; dateOrderPlaced date { columname=“CREATDTE” }; totalValue money? ; End Have you ever wondered what these actually are and where they come from?
Extensible Metadata - Annotation Types • All annotations are instances of an annotation type • An Annotation Type is a stereotyped Record definition Record ColumnName typeAnnotation {..} value string; end … DataItem SSN char(9){ columnName=“DB_SSN”, … } end
Extensible Metadata - Stereotypes • Stereotypes are Annotation Types that have been annotated with the @Stereotype annotation Record SQLRecord type Annotation { targets = [ ElementKind.Record ] @Stereotype{ memberAnnotations = [Column, IsReadOnly, …] } } tableNames string[][]; .. End
EGL Compiler as Model Compiler • EGL is a programming language mixed together with a modeling mechanism and extensible model compiler • Has conceptual affinity with UML Action Languages • What is an Extensible Model Compiler? • New concepts added to programming model • e.g. Entity, UI programming model, new Datatypes (i.e. ZonedUnicodeDecimal) • Existing compiler extended to map instances of new concepts used in the code to appropriate runtime • Very high fidelity interleaving of new extended code generation into existing code generation • Can override/extend any aspect down to low level Expressions
EDT – Code generation process Eclipse EGL Source Code EGL Compiler Model Possible Extensible Code Generation Framework Pluggable Generators Java Java JavaScript C/C++ .Net COBOL … Pluggable Extension Examples JEE Dojo Android CICS/IMS
Module Structure of EDT: org.eclipse.edt org.eclipse.edt.ide org.eclipse.edt.core org.eclipse.edt.gen
Extensible Model Compilers: org.eclipse.edt.gen • Core Model Transformation framework • Model to Model, i.e. EDT MOF model to EMF model • Model to Text, i.e. EGL Model model to Java • All EDT code generation based upon this framework • Simple and lightweight and highly extensible • Extensibility comes from configurable ‘Templates’ • A Template is simply a java Class • Each model element has a Template associated with it • Each Template implements methods that perform some transformation on its given model element • All template method invocation follows the inheritance hierarchy of the given model • If a given template method does not exist in the specific template of the model element method lookup will go up the super type chain • Extending an existing transformation is simply a matter of adding and replacing templates with new ones that: • Add new • Replace the original • Extend the original
EDT Core Generators • EDT will provide ‘core’ generators for Java and JavaScript • A ‘core’ generator is one that implements a transformation to a target runtime technology that adheres to the semantics of the ‘Core’ EGL Language • EGL Core will be the EGL specification containing: • Syntax and semantics for declaring EGL definitions • Execution semantics for statements and expressions • Semantic descriptions for extensible IO statements • GET, ADD, etc. with no description for specifics like SQL access • EGL Core will not specify any metadata specifications except for those necessary to define other metadata • Annotation and Stereotype are types themselves known to the compiler Core generators
EDT Extended Generators • An Extended Generator contains: • Specific set of metadata types, i.e. SQLRecord, TextProgram, etc • Extension to a core generator with new templates built for new set of metadata types • Runtime support libraries if necessary • EDT will also provide a set of extended generators to support common platforms • JEE Generator extends core Java generator • Support of Web Services, JPA, etc. • Core JavaScript Generator extended to handle current RUI programming model Extended generators
EGL Compilers and the IDE • An EGL Compiler: • Is a set of Metadata extensions with an intended programming model • Compiles EGL source using those definitions into IR files • Is configured with a set of extended generators that generate code to intended runtime • Many EGL Compilers exist in the IDE at the same time as separate plug-ins • Each ‘family’ of generators manage their inputs/outputs independently • Each project configures the compiler of choice • Each resource inside that project can choose a particular set of generators to use Configured Compilers: EDT, RBD, Android
RBD Future EDT Java Generator EDT JavaScript Generator RBD COBOL Generator EDT EDT Java Generator EDT JavaScript Generator RBD Java Generator Generation Framework Generation Framework RBD JavaScript Generator EGL Parser and Compiler EGL Parser and Compiler EGL Tools Extended EGL Tools EGL Tools Eclipse IBM Open source RBD / EDT Integration Direction RBD 8.0.1 COBOL Generator Java Generator JavaScript Generator EGL Parser and Compiler EGL Tools Eclipse
UI Programming Model Example: Define Abstract Concepts • Abstract concepts derived from concepts common across UI frameworks • Window – deployable UI unit • Android – Activity • Web – HTML Page • View – Super type of all UI controls • Android – View • SWT – Widget • ViewGroup – contains View children • Android – ViewGroup • Dojo – Container • TableLayout – kind of ViewGroup for Tables Window 1 contentView View * children ViewGroup TableLayout
UI Programming Model Example: Define Concepts in EGL Abstract concepts defined using Externaltype with AbstractType stereotype Event handlers modeled as Delegates Inheritance modeled directly Externaltype declarations allow for full Class modeling
UI Programming Model Example: Define Concepts in EGL Core UI Concepts Stereotypes for implementation Concrete Widgets
Example Usage: Mortgage Calculator Stereotype used to implement a Window Similar conceptually to RUIHandler Declaration of Widgets and properties Event handler declaration Invocation of the Amortize Service
Create the AndroidGenerator class Android generator extends core Java generator Adds command line parameters as necessary Define where the configuration is for adding and overriding code generation templates Define where the configuration is for mapping abstract types to concrete classes in the runtime
Create Necessary Templates Override existing method from Template from Core Template method invocation
Map Model to Android Templates Mapping of model classes to their templates