cg2012 niet-geanimeerd

Post on 14-Jul-2015

190 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Eric Jan MalotauxCode Generation 2012, Cambridge, UK2012-03-28

1

Overview

3

OVERVIEW

Who I Am

The Assignment

Renovating applications

The Strategy

Lessons Learned

Unsolved Problems

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

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

6

THE ASSIGNMENTTHE 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 DLL's for complicated calculations

8

THE ASSIGNMENTTHE 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)

9

THE ASSIGNMENTWHY 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

Doesn't 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

Renovating applications

Requirements

Specifications

Implementation

Goals

Legacy application Renovated application

Requirements

Specifications

Implementation

Goals

Implementation

Automatic C++ to Java translation

Legacy application Renovated application

Requirements

Specifications

Implementation

Goals

Specifications

Implementation

Automatic C++ to Java translation

update

Legacy application Renovated application

reverse engineering

Requirements

Specifications

Implementation

Goals Goals

Requirements

Specifications

Implementation

Automatic C++ to Java translation

update

update

update

Legacy application Renovated application

reverse engineering

reverse engineering

reverse engineering

The Strategy

Requirements

FASTmodel

(database)

C++implementatio

n

Goals

Javaimplementatio

n

Legacy application Renovated application

C++ generator C++ generator

Requirements

FASTmodel

(database)

C++implementatio

n

Goals

Mod4Jmogram

(textual DSL)

Javaimplementatio

n

C++ extractor

Xpandgenerator

Legacy application Renovated application

C++ generator C++ generator

Requirements

FASTmodel

(database)

C++implementatio

n

Goals

Mod4Jmogram

(textual DSL)

Javaimplementatio

n

C++ extractor

Xpandgenerator

Legacy application Renovated application

C++ generator C++ generator

FASTmodel(xmi)

C++extractor

Xtend2generator

Requirements

FASTmodel

(database)

C++implementatio

n

Goals

Javaimplementatio

n

Legacy application Renovated application

C++ generator C++ generator

FASTmodel(xmi)

C++extractor

Xtend2generator

Migrating the (meta)models

SQL

FASTmetamodel(relational)

FMAmodel

(database)

FMAuser data

expressed in

expressed in

AbstractSyntax

“Class Tree”

C++

Modelobjectgraph

expressed in

expressed in

load

FMAexpor

t(C++)

UML

FASTmetamodel

expressed in

EA C++import

Ecore

FASTmetamodel

(ecore)

expressed in

EA ecoreexport

FMAmodel(xmi)

expressed in

FMAapplication

Export

generator

(xtend2)FMAgen

erators

(xtend2)

Old

M2

M1

M0

M3

NewIntermediate(Enterprise Architect)

FMAgen

erators

(C++)

FASTmetamo

del

FMAmodel

(database)

FMAmodel

Load/extract

FAST“Class

Tree”

Enterprise

Architect

FASTmetamo

del(ecore)

FMAmodel(XMI)

EMFgenerato

r

FASTmodel

Java API

FASTeditor

FMA(Java)

JNAadapters(Java)

FASTframewo

rk(Java)

External(MQ)

classes

(Java)

maven/javac/build

FMA(JWS/jar

)FMAdata

FMAexample(Java)

External(MQ)

classes

(C++)

FASTframewo

rk(C++)

Extractor

generator

(xtend2)

FMA

generator

(xtend2)

given

generated

manual

tools

Legenda

Lessons Learned

24

LESSONS LEARNEDThe value of an explicit metamodel

Help in understanding the model

Generated export program

Generated tree editor

Generated model API

Basis for a new DSL

25

LESSONS LEARNEDGenerator architecture

Consistent naming

Use an intermediate model

26

LESSONS LEARNEDIncompatible 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

27

LESSONS LEARNEDKnow 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

28

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

29

REMAINING CHALLENGEMaintaining 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.

30

www.ordina.nl

top related