Presentation is loading. Please wait.

Presentation is loading. Please wait.

Code Generation in CDE Remi Lequette ILOG.

Similar presentations

Presentation on theme: "Code Generation in CDE Remi Lequette ILOG."— Presentation transcript:

1 Code Generation in CDE Remi Lequette ILOG

2 Overview Introduction CDE architecture Generation technique Conclusion
ILOG & VCM CDE CDE architecture Cartridge structure Generated artifacts Generation technique The OPML language The UML model The generators Conclusion

3 ILOG Provides Software Components VCM Division
C++ and Java class libraries Graphics, Rules Optimization: Linear, Constraints, Scheduling, Dispatching. Telecom, Transportation & Finance, VCM Provides consulting VCM Division Value Chain Management (production & distribution planning) ISV customers (SAP, Oracle, …) ERP - SCM End User customers (in house development)

4 CDE - Cartridge Development Env.
Target is ERP - SCM users They have data and an execution system They have an optimization problem Generic solution is not applicable They buy a solution from ILOG consulting Consulting firm Third party reusable solution CDE provides cartridges Reusable architecture Code, projects, documentation generation Data access (files, RDBMS, ERP system) Increase productivity by focus on optimization code

5 CDE Cartridge Provides a standard architecture
Application Server Cartridge Algorithm Control GUI Data Model Provides a standard architecture Provides a flexible integration framework Provides a toolbox for development Architecture

6 Detailed Architecture
high level entry points GUI, console, batch Commands Internal Mapping Data Model Algorithm Control Transformation External optimization algorithm interface to external data sources Architecture internal object-oriented model internal relational model mapping

7 Typical Data Flow Control 2. mapping & check
3. data transformation & check 1. data loading Commands Internal Mapping Data Model Algorithm Control Transformation External 7. solution saving 4. optimization Architecture 5. solution transformation & check 6. mapping & check

8 Cartridge Generation Control customizable module Commands External
Mapping Algorithm Transformation Data Model Internal Mapping CDE/ILOG libraries CDE code generation Structure Commands Model Tables ECPI CDE specification Integrator Developer Architecture Integrator

9 Generated Artifacts Code Documentation GUI Directories
Data model in C++ Script access to the data model Relational mapping Documentation Classes, tables, commands GUI Code and panels for testing the cartridge Directories Project organization, test structure Compilation projects For Microsoft Visual Studio

10 Generation Technology
OPML specification Templates CDE Generator Data Access Model Implementation HTML documentation Scripting Interface CDE Libraries Algorithm Cartridge ILOG optimization Libraries Architecture

11 Cartridge Specification Language
Object Property Modeling Language (OPML) Based on UML concepts: classes, components, stereotypes... Textual language Specification of cartridge organization, data model (C++, script), mappings, commands… Advanced property management: Properties can be attached to model elements Property tool Declares available properties for a tool: cpp, script, documentation... Property definition = name, types, default values, related elements... Property instance holds property values for a given model OPML

12 Project Top level namespace Contains categories and subsystems
// This is an internal comment #include <ilcde/case/opml/opml.pty> #include <ilcde/datacon/ecpi/RelationalSchema.pty> #include <ilcde/datacon/ecpi/dbm.pty> project christmas { cpp : Cpp; // C++ generation jscript : JScript; // scripting category classes {…} subsystem components {…} } include of other OPML files declares property instances contains categories and subsystems Top level namespace Contains categories and subsystems OPML

13 Categories and Classes
project christmas { ... category christmas { cpp.generate = yes; visibility= private; /** * HTML Documentation for Location */ class Location { } class Application : ilcde::Collector { visibility= protected; assigns a Cpp property for the category assigns OPML property defines “christmas::Location” Class super class OPML

14 Stereotypes Gives a specific semantic to an element
Used to set properties on OPML elements <<table>> class EMPLOYEE { ... } class Member { fullName : String { custom = true; readOnly = true; } ... class Member { <<derived>> fullName : String; ... } OPML

15 Attributes and Roles Attribute: primitive types and external classes
class Solution { name : String; <<static>> LastId : ID = "0"; } class Member { birthDate : Date { before; class Location { role family : Family; Attribute: primitive types and external classes Role: reference to one or more objects OPML

16 Operations parameter return type Default value class Member {
operation computeAge( today : Date ): Integer { const; } <<static>> operation DateToInteger( d1 : Date ) : Integer; <<virtual>> operation doIt(); class Family { operation addNewMember( name : String, birthDate : Date = “0”, info : String = “\”no info\”” ); ... OPML Default value

17 Dependencies Define relations between elements
project christmas { ... #include <ilcde/stdtypes.opml> category christmas { cpp.generate = yes; collect; <<import>> depends : ilcde; class ID { id : String; } class Location { declares the “ilcde” category imports “ilcde” category accessible string type OPML

18 Subsystems and Components
Component = logical or physical part Subsystem = group of components component that defines the documentation to be generated project christmas { ... category christmas { } subsystem doccomp { <<documentation>> component ModelDoc { = html; modelDoc.htmlHome=""; modelDoc.htmlHelp="help.html"; modelDoc.title="christmas related classes"; depends categories : christmas; OPML selection of categories

19 Script Language ILOG Implementation of JavaScript Used for Pros Cons
Extended with access to C++ classes generated with CDE Interpreted language with “object-oriented” features Used for Cartridge Development Test and Debug Pros Flexible, fast development Clean binding of C++ Good language structure (scopes) Cons No type checking Weak object-oriented model for pure script code

20 The UML Model Written in OPML Model generated with CDE
Parser reads the OPML file and create model in memory Provides powerful property access Script interface for writing generators

21 Generators Written in Script Control structure in script
Generated areas with special comments A preprocessor adds the write statements ${} { if (clazz.hasConstructor() { ${}(); } ...

22 Preserved Areas Set by the generator The old file is read
The content is preserved Note that new file is compared with old file Generator.printPreserveArea(“beforeClass_” ${} { ... //beginPreserve beforeClass_MyClass Add user code here //endPreserve beforeClass_MyClass class MyClass { ...

23 Generation Framework Written in Script
A hierarchy of “Controllers” for structure mapping OpmlController : Iterates on UML elements APIController: Generate operations to access the attributes CppController: Provides filtering for C++ Header and Code file generator Tools for element mappings C++ name of a class C++ prototype for an operation

24 Conclusion CDE OPML Generators with Script
Already used with good feedbacks Used within CDE (UML, libraries) OPML Powerful modeling tool, easy to extend. Lack graphic interface. Generators with Script Very flexible (no rigid structure) Easy to write a framework for reuse Lack compile-time checks Lack formal description

Download ppt "Code Generation in CDE Remi Lequette ILOG."

Similar presentations

Ads by Google