SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Downloaden Sie, um offline zu lesen
Acceleo
Code Generation
    From the model
 to the Android app


           Stéphane Bégaudeau
   stephane.begaudeau@obeo.fr

                  Gaël Blondelle
         gael.blondelle@obeo.fr
Goals of the tutorial
Goals of the tutorial
  Beginners             See a simple concrete case study




Acceleo addicts           Discover new killing features




Android experts   Learn enough to build a full fledged generator
I 'm   not


       an Android
   development expert
1.



            Acceleo:
A new code generator
A long history...

From Acceleo.org in 2006...


             ...to Eclipse.org in 2009

         Version 3.0 is part
                             of the
        Eclipse Helios rele
                           ase train
A long history...



                    Acceleo 3




 Acceleo 2
A new code generation
language

                     Implementation
   Metamodel and
                     of the Model To
  templates based
                        Text OMG
    technology
                     standard (MTL)




                     Tooling to help
  Eclipse Modeling   starting a new
    / M2T Project    generator from
                         scratch
                                       8
The Acceleo SDK

                Acceleo
           Development Tools



      =         +
           Acceleo Runtime
          (Compiler + Engine)


                  Eclipse independant: can be
                  run anywhere (plain old Jar,
                                            9
                        OSGi, Eclipse...)
2.

Prototype
   based
approach
Let's have a look at the
  Android prototype
Unlock the power of your models


  Java UI                 Java DB

       Different kinds of source
       artifacts to be generated

    XML                 Properties
                                     12
Good Practice


On  e kind of f ile to be
      gen erated...
           L file to b e created
...one MT                     13
t, databas   e adapter,
Manifes                  n p a g e,
properties   file, editio
   e dition pag   e layout...
A little bit of syntax
              Header




                       15
A little bit of syntax




              B o dy
                       16
A little bit of syntax
Templates are better for generating text
          and return a string




Queries can return any kind of objects



 You can call Java services from a template or a query



              The result of a query is stored in a cache.   17
The workflow file



                   ion
          a nnotat
    @main
            The MTL file
          calling the other
                ones          18
Initialize the generation project




                  1. Create new
                  Acceleo project

                  2. Use the wizard
                  (update file paths)


                  3. Create a
                  workflow file         19
3... 2... 1...

                                 Anything
   Launch         Generated
                                  that can
configuration     Java Main
                               launch Java...


         Same
Stand
        VM as     Standalone     Standalone
alone
        Eclipse


                                              20
Ignition

 1. Launch the
 generator
 (launch config as Eclipse plugin)


                                 21
From a static generator...



      … to a dyna mic one

3.
Quick replacement




 Select a text section in the
 template, then hit "Content
      Assist" hotkeys
                                23
Hierarchy Tree

       Select a text section in the
       template, then right-click
          "Source > As For/If"



                                 24
Good Practice




           " i s qu i c k b ut dirty...
"As For/If

     ...use template

            ymorphism instead!!
        pol                           25
Generation patterns




Use the Generation
  Patterns View


                      26
Extract as
       S elect a text section in the
        template, then right click
     "Refactor > Extract as template"

             template
                                        27
Refactoring




Alt + Shift + R
                  28
Launch the generator
 - open the Result view
 - launch config as Eclipse plugin
 - activate the Traceability




                                     Have a look at the Result view
4.


Make the Android App
                 run
                   30
Debug your templates




Thanks to Acceleo
    debugger


                    31
Configure the
Android Development Kit


 Set the path to the
   SDK location

                       Create a new A
                                      ndroid
                       Virtual Device
                                      - AVD
                                               32
Turn on the phone




                33
5.


A generic Android App
            generator
                    34
Create a fresh new model
Generate new
       Android Apps



                 36
6.

A new App
   in a few
     clicks
         37
Packaging and deploying

Generate an Eclipse     Add an action on
    UI plugin         right-click on models




                        Synchronize your
 Create a builder
                      code and your model


                                            38
Packaging settings

 Filename pattern
    of the model


 Target folder of
 the generation


          Warning Eclipse specific
                                     39
Workout

          1. Create new
          Acceleo UI project

          2. Use the wizard
                        nd
          3. Launch a 2
          Eclipse Runtime
          and test             40
7.



Override specific behavior
                        41
Overriding existing generators

                    Eclipse-o
                             nly
      Static      Dynamic
    overriding   overriding




                                   42
Overriding behavior
              Module A

              Template
                MT
         es
    rrid




                             Imports
                                       Module C
ove




                   Extends

              Module B
                                C invok  es MT, B.MT
              Template           wi ll be executed
                MT
                                                       43
Lost code

   A common problem
 with code generators...



            if you change the
            generated code...


                 your modifications are lost
                 during the next generation.
                                           44
Protected area
                        Will not be erased
                        after re-generation




                         Dont forget the
                        comments marks...
© Copyright 2010




                                              ... and the ID
     Obeo




                   45
@Generated
 Acceleo also uses
      JMerge




                     You can protect a
                     whole block with a
                     simple comment
8.
© Copyright 2010
     Obeo




                   The next step: Acceleo 3.1
                   47
© Copyright 2010
          Obeo




48
                        Documentation
© Copyright 2010
          Obeo




49
                        UI Improvements
Thank you for your attention!
        Questions?

Weitere ähnliche Inhalte

Andere mochten auch

MoDisco EclipseCon2010
MoDisco EclipseCon2010MoDisco EclipseCon2010
MoDisco EclipseCon2010fmadiot
 
EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)mikaelbarbero
 
IFML - The interaction flow modeling language, the OMG standard for UI modeli...
IFML - The interaction flow modeling language, the OMG standard for UI modeli...IFML - The interaction flow modeling language, the OMG standard for UI modeli...
IFML - The interaction flow modeling language, the OMG standard for UI modeli...Marco Brambilla
 
Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Marco Brambilla
 
You need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesYou need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesPhilip Langer
 
ATL tutorial - EclipseCon 2008
ATL tutorial - EclipseCon 2008ATL tutorial - EclipseCon 2008
ATL tutorial - EclipseCon 2008William Piers
 
Programming in UML: An Introduction to fUML and Alf
Programming in UML: An Introduction to fUML and AlfProgramming in UML: An Introduction to fUML and Alf
Programming in UML: An Introduction to fUML and AlfEd Seidewitz
 
The Unbearable Stupidity of Modeling
The Unbearable Stupidity of ModelingThe Unbearable Stupidity of Modeling
The Unbearable Stupidity of ModelingPeter Friese
 
Model-Driven Software Engineering in Practice - Chapter 1 - Introduction
Model-Driven Software Engineering in Practice - Chapter 1 - IntroductionModel-Driven Software Engineering in Practice - Chapter 1 - Introduction
Model-Driven Software Engineering in Practice - Chapter 1 - IntroductionMarco Brambilla
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific LanguagesJavier Canovas
 
Real world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageReal world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageMario Fusco
 
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)Jordi Cabot
 
Uml to code with acceleo
Uml to code with acceleoUml to code with acceleo
Uml to code with acceleoTarun Telang
 
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling FrameworkEclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling FrameworkDave Steinberg
 
Single-Source approach to the design of HW/SW Embedded Systems
Single-Source approach to the design of HW/SW Embedded SystemsSingle-Source approach to the design of HW/SW Embedded Systems
Single-Source approach to the design of HW/SW Embedded SystemsEugenio Villar
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklNeo4j
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewEelco Visser
 

Andere mochten auch (20)

MoDisco EclipseCon2010
MoDisco EclipseCon2010MoDisco EclipseCon2010
MoDisco EclipseCon2010
 
EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)EMF Compare 2.0: Scaling to Millions (updated)
EMF Compare 2.0: Scaling to Millions (updated)
 
IFML - The interaction flow modeling language, the OMG standard for UI modeli...
IFML - The interaction flow modeling language, the OMG standard for UI modeli...IFML - The interaction flow modeling language, the OMG standard for UI modeli...
IFML - The interaction flow modeling language, the OMG standard for UI modeli...
 
Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...
 
You need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF ProfilesYou need to extend your models? EMF Facet vs. EMF Profiles
You need to extend your models? EMF Facet vs. EMF Profiles
 
ATL tutorial - EclipseCon 2008
ATL tutorial - EclipseCon 2008ATL tutorial - EclipseCon 2008
ATL tutorial - EclipseCon 2008
 
Programming in UML: An Introduction to fUML and Alf
Programming in UML: An Introduction to fUML and AlfProgramming in UML: An Introduction to fUML and Alf
Programming in UML: An Introduction to fUML and Alf
 
The Unbearable Stupidity of Modeling
The Unbearable Stupidity of ModelingThe Unbearable Stupidity of Modeling
The Unbearable Stupidity of Modeling
 
Model-Driven Software Engineering in Practice - Chapter 1 - Introduction
Model-Driven Software Engineering in Practice - Chapter 1 - IntroductionModel-Driven Software Engineering in Practice - Chapter 1 - Introduction
Model-Driven Software Engineering in Practice - Chapter 1 - Introduction
 
Domain-Specific Languages
Domain-Specific LanguagesDomain-Specific Languages
Domain-Specific Languages
 
Introducing MDSD
Introducing MDSDIntroducing MDSD
Introducing MDSD
 
Real world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same languageReal world DSL - making technical and business people speaking the same language
Real world DSL - making technical and business people speaking the same language
 
OCL tutorial
OCL tutorial OCL tutorial
OCL tutorial
 
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)
MDD - Desarrollo de software dirigido por modelos que funciona (de verdad!)
 
Uml to code with acceleo
Uml to code with acceleoUml to code with acceleo
Uml to code with acceleo
 
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling FrameworkEclipse World 2007: Fundamentals of the Eclipse Modeling Framework
Eclipse World 2007: Fundamentals of the Eclipse Modeling Framework
 
Single-Source approach to the design of HW/SW Embedded Systems
Single-Source approach to the design of HW/SW Embedded SystemsSingle-Source approach to the design of HW/SW Embedded Systems
Single-Source approach to the design of HW/SW Embedded Systems
 
Combine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quicklCombine Spring Data Neo4j and Spring Boot to quickl
Combine Spring Data Neo4j and Spring Boot to quickl
 
Unified Modeling Language
Unified Modeling LanguageUnified Modeling Language
Unified Modeling Language
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & Overview
 

Ähnlich wie Acceleo Code Generation

Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)mikaelbarbero
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - envgrondin
 
Modeling With Eclipse @SoftShake 2011
Modeling With Eclipse @SoftShake 2011Modeling With Eclipse @SoftShake 2011
Modeling With Eclipse @SoftShake 2011Mickael Istria
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allMarc Dutoo
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware
 
Pragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWarePragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWareMichael Vorburger
 
Keil tutorial
Keil tutorialKeil tutorial
Keil tutorialanishgoel
 
2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertagMarcel Bruch
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Codemotion
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_javaHarry Potter
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingJames Wong
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingLuis Goldster
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_javaHoang Nguyen
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_javaTony Nguyen
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingYoung Alista
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingFraboni Ec
 
Tools For Software Engineering
Tools For Software EngineeringTools For Software Engineering
Tools For Software EngineeringSébastien Mosser
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Pratima Parida
 

Ähnlich wie Acceleo Code Generation (20)

Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
Generating an Android App with Acceleo (Eclipse Summit Europe 2010)
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - en
 
Modeling With Eclipse @SoftShake 2011
Modeling With Eclipse @SoftShake 2011Modeling With Eclipse @SoftShake 2011
Modeling With Eclipse @SoftShake 2011
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
 
Pragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWarePragmatic Model Driven Development using openArchitectureWare
Pragmatic Model Driven Development using openArchitectureWare
 
Keil tutorial
Keil tutorialKeil tutorial
Keil tutorial
 
2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag2010 06-24 karlsruher entwicklertag
2010 06-24 karlsruher entwicklertag
 
Effective Java
Effective JavaEffective Java
Effective Java
 
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
Matteo Valoriani, Antimo Musone - The Future of Factory - Codemotion Rome 2019
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Tools For Software Engineering
Tools For Software EngineeringTools For Software Engineering
Tools For Software Engineering
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 
Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)Java Semimar Slide (Cetpa)
Java Semimar Slide (Cetpa)
 

Mehr von Stéphane Bégaudeau

Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Stéphane Bégaudeau
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Stéphane Bégaudeau
 
Modern Web Application Development Workflow - web2day 2014
Modern Web Application Development Workflow - web2day 2014Modern Web Application Development Workflow - web2day 2014
Modern Web Application Development Workflow - web2day 2014Stéphane Bégaudeau
 
Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014Stéphane Bégaudeau
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedStéphane Bégaudeau
 

Mehr von Stéphane Bégaudeau (6)

Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014Modern Web Application Development Workflow - EclipseCon Europe 2014
Modern Web Application Development Workflow - EclipseCon Europe 2014
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
 
Modern Web Application Development Workflow - web2day 2014
Modern Web Application Development Workflow - web2day 2014Modern Web Application Development Workflow - web2day 2014
Modern Web Application Development Workflow - web2day 2014
 
Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014Modern Web Application Development Workflow - EclipseCon US 2014
Modern Web Application Development Workflow - EclipseCon US 2014
 
AngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get startedAngularJS 101 - Everything you need to know to get started
AngularJS 101 - Everything you need to know to get started
 
Mylyn Task connector for Tuleap
Mylyn Task connector for TuleapMylyn Task connector for Tuleap
Mylyn Task connector for Tuleap
 

Acceleo Code Generation