Iterative and-agile-codegen
Upcoming SlideShare
Loading in...5
×
 

Iterative and-agile-codegen

on

  • 4,853 views

 

Statistics

Views

Total Views
4,853
Slideshare-icon Views on SlideShare
1,287
Embed Views
3,566

Actions

Likes
1
Downloads
19
Comments
0

9 Embeds 3,566

http://mickaelistria.wordpress.com 3243
http://planet.jboss.org 204
http://www.jboss.org 107
http://www.tuicool.com 6
https://mickaelistria.wordpress.com 2
http://translate.googleusercontent.com 1
http://webcache.googleusercontent.com 1
http://www.365dailyjournal.com 1
http://www.linkedin.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Demo figures avec modifs successives
  • * Reconciliers are very difficult pieces of code. And they are only a “workaround”, it is not very agile
  • * Advantage over modifying generated code → Less lines to maintain → Default behavior still works/customization is isolated → if Generator changes drastically, default still work, customization will show you compile errors => easier to debug

Iterative and-agile-codegen Iterative and-agile-codegen Presentation Transcript

  • Iterative and agile principles applied to code generationMickael Istria, EclipseCon 2012, CC-BY 2.0@mickaelistria for Tweeters
  • Code GenerationGenerator Generation Config Generated Code $ $$$$$
  • Reminds me somethingGrace Hopper, Inventor of the first compiler (A-0 compiler, 1952)
  • CompilationSource Code Compilation “Binary” code $ $$$$$
  • Code Generation followsthe same patterns, rules and principles as Compilation
  • This is what you want to maintain Generator Generation Config Generated CodeBy the way, yes, configuration is source code
  • IterationsGenerator Generated Code v1 GenerationConfig v1 Generator Generated Code v2 Generation Config v2 Generator Generation Generated Code v3 Config v3
  • You need something not supported by the generation framework...
  • You do not really own the generated code.Its internals are owned by the generation framework.
  • Modifying generated code does not scaleForces you to maintain generated classes, reducebenefits of generation.Can cause conflicts between configuration andmodified code.About @generated NOT: Do you trust yourgeneration framework reconcilier? I dont.Does not scale through generator upgrades.
  • Generation framework usually guarantee conformance to an API, to a specification to patterns. GMF Tooling guarantees results conform to GMF Runtime API and generated classes follow patterns Runtime API Implements Generator Generation Config Generated Code
  • Use generated code as an API for your custom code The “generation-gap pattern”http://heikobehrens.net/2009/04/23/generation-gap-pattern/
  • Runtime API ImplementsGenerator Generation Config Generated Code $ Clazz extends and @overrides $$$$$ CustomClas s $
  • Runtime API ImplementsGenerator Generation Config Generated Code $ Clazz extends and @overrides $$$$$ FavoriteFramework uses MyClass(not supported by generator)
  • How can I consume custom in generated without customizing all code depending on custom? How to re-inject your custom code to your generated noodle-plate ? Leverage underlying APIs.
  • GMFGMF editors follows a declarative “component- based” architecture. Most of default behavior classes can be replaced by custom via Eclipse extensions.
  • XTextUsing Google Guice binding and DependencyInjection.http://www.eclipse.org/Xtext/documentation/1_0_1/xtext.html#dependencyInjection
  • IN CASE OF EMERGENCY CUSTOMIZE GENERATOR ITSELFGMF Tooling has extendible Xpand templates.Xtext has a smart MWE workflow and Xtend templatesEMF has overridable JET templates