Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Transforming a 15 year old model-driven application from C++ to Java

5,057 views

Published on

Case Study presented a Code Generation 2012 (http://www.codegeneration.net/cg2012/) on March 28, 2012.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Transforming a 15 year old model-driven application from C++ to Java

  1. 1. 1Transforming a 15 year old model-drivenapplication from C++ to JavaEric Jan Malotaux Code Generation 2012, Cambridge, UK 2012-03-28
  2. 2. Overview
  3. 3. 3 OVERVIEW Who I Am The Assignment Renovating applications The Strategy Lessons Learned Unsolved Problems
  4. 4. 4 WHO AM I Eric Jan Malotaux Software Architect with Ordina, ICT service provider in the Netherlands Trained as a musician and musicologist 27 years experience in software development What I learned Automated procedures (software factory) as important as programming skills Communication and trust within a team even more important Specialties – anything that speeds up software development Software factories – automating as much as possible Agile development (extreme programming, Scrum) Model-driven code generation
  5. 5. The AssignmentTransforming a 15 year old model-driven application from C++ to Java
  6. 6. 6 THE ASSIGNMENT THE APPLICATION A very succesful mortgage application 185 screens 100 users Quarterly releases Sizeable model: 200,000 lines (10Mb) of XMI Using a proprietary model-driven code generator Several interfaces to external systems: queues Several native Windows DLLs for complicated calculations
  7. 7. 8 THE ASSIGNMENT THE MODELER/GENERATOR Old, but very complete Model in relational tables (DB2) Modeler written in MS-Access C++ Class Tree to keep model in memory Loader containing mapping (DB → Class Tree) knowledge Hand-written C++ framework, modeled Persistence support classes, including lazy loading User Interface support classes Action Language: COOL (Common Object Oriented Language) Methods on objects Actions on UI elements, like buttons Implicit metamodel (as far as known)
  8. 8. 9 THE ASSIGNMENT WHY TRANSFORM? Dependent on outdated C++ compiler and libraries Scarce expertise Model-driven techniques in general The proprietary modeler/generator in particular C++ Modeler/generator maintained, but not further development Doesnt fit in Enterprise Architecture Difficult to offshore Want a mainstream Java web application And no code generator anymore please, thank you very much. No dependency on proprietary tools Current developers where quite happy, though
  9. 9. Renovating applications
  10. 10. Legacy application Renovated application Goals Goals Requirements update Requirements reverse engineering Specifications update Specifications reverse engineering Implementatio Automatic C++ to Java translation Implementatio n n
  11. 11. The Strategy
  12. 12. Legacy application Renovated application Goals Requirements FAST FAST Mod4J FAST model C++ C++ C++ extractor model Xtend2 mogram model extractor extractor generator (database) (xmi) (textual DSL) (xmi) Xtend2 Xpand C++ generator C++ generator generator C++ Java implementatio implementatio n n
  13. 13. Migrating the (meta)models
  14. 14. Old Intermediate New (Enterprise Architect) SQL C++ UML EcoreM3 expressed in Abstract expressed in expressed in expressed in Syntax FAST FAST EA C++ FAST EA ecoreM2 metamodel “Class Tree” import metamodel export Expo metamodel (relational) rt (ecore) gene ra to r expressed in expressed in expressed in (xten d FMA 2) gen FMA FMA e FMA Model FMA exporM1 model gen load e object t r model (database) graph a (xmi) r (C++) t a o t r o s r (xte s n (C+ d + 2 FMA FMAM0 user data ) ) application
  15. 15. Ext r a Enterpri se c Legenda t Architect o given r FAST gen FAST manual FAST e EMF “Class metamo toolsmetamo r generato Tree del del a r ” (ecore) generated t o r FMA (xte n FMA FAST model Load/ d model model FM(databas extract 2 (XMI) Java API A e) ) gen e r a FAST t FMA editor o model r (xte n d JNA FMA 2 FMA ) adapters example (Java) (Java) (Java) FAST FAST maven/framewo framewo javac/ rk rk build (C++) (Java)External External (MQ) (MQ) FMA clas clas (JWS/jar FMA ses ses ) data (C++) (Java)
  16. 16. Lessons Learned
  17. 17. 18 LESSONS LEARNED The value of an explicit metamodel Help in understanding the model Generated export program Generated tree editor Generated model API Basis for a new DSL
  18. 18. 19 LESSONS LEARNED Generator architecture Consistent naming Use an intermediate model
  19. 19. 20 LESSONS LEARNED Incompatible source/target architecture Layering: classic client → server, modern three-tiered Lazy loading assumed in the COOL Action Language One Action Language for UI and Class Methods
  20. 20. 21 LESSONS LEARNED Know your tools Know your tools EMF is a great tool, once you obtain a copy of the EMF book Xtext2, needed for COOL Parser, difficult to integrate Xtend2, nice but still buggy
  21. 21. 22 REMAINING UNSOLVED PROBLEMS Eclipse is a hard to tame beast! Working combination of (versions of) plugins Hard to get rid of red crosses Continuous integration Maven ↔ OSGi: two worlds Eclipse artifacts (not) in public maven repositories
  22. 22. 23 REMAINING CHALLENGE Maintaining the migrated model Use the EMF-generated tree editor already as good as, or better than, the Access application Derive an Xtext grammar from the metamodel Manual adjustments Have a DSL almost for free Familiar concepts: the metamodel (language) was not changed.
  23. 23. 24 www.ordina.nl

×