Transcript EGL Open

EGL Online User Group: EGL Open Update
Tuesday, April 26, 2011
EGL Online User Group
Evolution of Language Abstraction
Many
Future
Multiple
Machine
One
Runtime
Platform
Many
EGL
One
One
Java
Many
One
OS
One
Single
Machine
One
Many
Hardware
One
One
One
Evolution of Execution
Environment
C, COBOL
Assembler
Range of Deployment
Options
Evolution of Programming
Languages
2
EGL Online User Group
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.
3
EGL Online User Group
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
4
EGL Online User Group
Extensible Metadata – SQLRecord Example
// A Record type definition mapped to a database table
Record Order type SQLRecord {
tableNames = [“ORDER”],
keyItems=[“orderID”] }
Have you ever wondered what these actually are
and where they come from?
orderID OrderID { columnName=“ORDERID” };
dateOrderPlaced date { columname=“CREATDTE” };
totalValue money? ;
End
5
EGL Online User Group
Extensible Metadata - Annotation Types
 All annotations are instances of an annotation type
 An Annotation Type is a stereotyped Record definition
Record ColumnName type Annotation {..}
value string;
end
…
DataItem SSN char(9){
columnName=“DB_SSN”, … }
end
6
EGL Online User Group
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
7
EGL Online User Group
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
8
EGL Online User Group
EDT – Code generation process
Eclipse
EGL
Compiler
EGL Source
Code
Possible
Model
Extensible Code Generation Framework
Java
JEE
Java
Android
JavaScript
Dojo
C/C++
.Net
COBOL
CICS/IMS
…
Pluggable
Generators
Pluggable
Extension
Examples
9
EGL Online User Group
Module Structure of EDT: org.eclipse.edt
org.eclipse.edt.ide
org.eclipse.edt.core
org.eclipse.edt.gen
10
EGL Online User Group
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
11
EGL Online User Group
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
12
EGL Online User Group
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
13
EGL Online User Group
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
Configured Compilers: EDT, RBD, Android
 Each resource inside that project can choose
a particular set of generators to use
14
EGL Online User Group
RBD / EDT Integration Direction
Open
sourc
e
IBM
RBD 8.0.1
COBOL
Generator
Java
Generator
JavaScript
Generator
RBD Future
RBD
COBOL
Generator
EGL Parser and Compiler
EGL Tools
EDT
Eclipse
EDT Java
Generator
EDT
JavaScript
Generator
Generation Framework
EGL Parser and Compiler
RBD
Java
Generator
EDT
Java
Generator
EDT
JavaScript
Generator
Generation Framework
RBD
JavaScript
Generator
EGL Parser and Compiler
Extended EGL Tools
EGL Tools
EGL Tools
Eclipse
15
Android Generator: an example
EGL Online User Group
UI Programming Model Example: Define Abstract Concepts
 Abstract concepts derived from concepts common
across UI frameworks
Window
 Window – deployable UI unit
1
contentView
View
*
 Android – Activity
 Web – HTML Page
children
 View – Super type of all UI controls
 Android – View
ViewGroup
 SWT – Widget
 ViewGroup – contains View children
 Android – ViewGroup
 Dojo – Container
TableLayout
 TableLayout – kind of ViewGroup for Tables
17
EGL Online User Group
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
18
EGL Online User Group
UI Programming Model Example: Define Concepts in EGL
Core UI Concepts
Stereotypes for implementation
Concrete Widgets
19
EGL Online User Group
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
20
EGL Online User Group
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
21
EGL Online User Group
Create Necessary Templates
Override existing method
from Template from Core
Template method invocation
22
EGL Online User Group
Map Model to Android Templates
Mapping of model classes to their templates
23
EGL Online User Group
Running Mortgage Calculator on Android Emulator
24
EGL Online User Group
Questions?
25
EGL Online User Group
Thank you!
26