Скачать презентацию Code Generation in CDE Remi Lequette ILOG 0 Скачать презентацию Code Generation in CDE Remi Lequette ILOG 0

ea44cb6fcbe6f20939cc1b5dcd02dd64.ppt

  • Количество слайдов: 24

Code Generation in CDE Remi Lequette ILOG 0 -1 Code Generation in CDE Remi Lequette ILOG 0 -1

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

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

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

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

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

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

Cartridge Generation customizable module Commands Tables ECPI or In te gr at pe lo Cartridge Generation customizable module Commands Tables ECPI or In te gr at pe lo ve te In 8 gr at or Architecture Commands Internal Mapping External Mapping r Structure De CDE specification Data Model Algorithm CDE code generation Transformation Control CDE/ILOG libraries

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

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

Cartridge Specification Language £ Object Property Modeling Language (OPML) £ £ Based on UML 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 £ £ OPML 11 £ 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

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

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

Stereotypes £ Gives a specific semantic to an element <<table>> class EMPLOYEE {. . Stereotypes £ Gives a specific semantic to an element <

> class EMPLOYEE {. . . } £ Used to set properties on OPML elements class Member { <> full. Name : String; . . . } OPML 14 class Member full. Name : custom = read. Only }. . . } { String { true; = true;

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

Operations parameter return type class Member { operation compute. Age( today : Date ): Operations parameter return type class Member { operation compute. Age( today : Date ): Integer { const; } <> operation Date. To. Integer( d 1 : Date ) : Integer; <> operation do. It(); } class Family { operation add. New. Member( name : String, birth. Date : Date = “ 0”, info : String = “”no info”” ); . . . } OPML 16 Default value

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

Subsystems and Components £ £ Component = logical or physical part Subsystem = group 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 { <> component Model. Doc { model. Doc. target = html; model. Doc. html. Home="http: //www. ilog. fr"; model. Doc. html. Help="help. html"; model. Doc. title="christmas related classes"; depends categories : christmas; OPML 18 } } } selection of categories

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

The UML Model £ £ £ 20 Written in OPML Model generated with CDE The UML Model £ £ £ 20 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

Generators £ Written in Script £ £ £ Control structure in script Generated areas Generators £ Written in Script £ £ £ Control structure in script Generated areas with special comments (//@) A preprocessor adds the write statements … //@class ${clazz. name} { if (clazz. has. Constructor() { //@ ${clazz. name}(); }. . . 21

Preserved Areas £ Set by the generator £ £ £ The old file is 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. print. Preserve. Area(“before. Class_”+clazz. name) //@class ${clazz. name} {. . . 22 … //begin. Preserve before. Class_My. Class Add user code here //end. Preserve before. Class_My. Class class My. Class {. . .

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

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