Acceleo - Let's start with an Android example

9,646 views
9,534 views

Published on

--- Eclipse Con 2010 ---

Acceleo is a pragmatic implementation of the OMG* standard for code generation called MTL*. Still in incubation state, we plan to have Acceleo graduate for the next Eclipse simultaneous release (Helios).

Being an expert at code generation or Acceleo is not necessary to get started on your first code generator : using the Acceleo editor and the powerful features it exposes (completion, syntax highlighting, on-the-fly compilation, quick outline, ...), it is very easy to get started once you understand the most basic principles.

This talk presents both the MTL language and the Acceleo Development Toolkit which is provided in the M2T project. Beginners will learn what code generation, M2T, and Acceleo are, as well as how to use them on a concrete case-study. Acceleo addicts will discover the new standard syntax, new functionalities and techniques. We will give you enough of the basics to create your own code generation for a specific target system. We have chosen the Android platform as a target to show that we can also use Acceleo for mobile software.

Here is the talk agenda :
- Acceleo : What's that new code generation engine?
- Create an Android prototype and its corresponding model
- Initialize your code generation project from the prototype
- Editing your code generation file to make the Android prototype run
- Launching your code generation on another model example
- Packaging as an eclipse plug-in and for standalone usage
- Create new Android applications in few clicks
- How to override a specific behavior in the target environment
- On the developper side : How to make your own extensions with Acceleo?

We'll end the talk with other complex code generation examples made with Acceleo : EEF, UML to Java, Ecore to python, Migrating from a language to another...

*OMG : Object Management Group
*MTL : Model to Text Language

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,646
On SlideShare
0
From Embeds
0
Number of Embeds
2,519
Actions
Shares
0
Downloads
211
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Acceleo - Let's start with an Android example

  1. 1. Acceleo Code Generation Let's start with an Android example Jonathan Musset - jonathan.musset@obeo.fr Obeo 1
  2. 2. Acceleo Code Generation Let's start with an Android example Acceleo : what's that new code generation engine? Meta-model and templates based technology Implementation of the Model To Text OMG standard (MTL) Eclipse Modelling / M2T project Pragmatic approach – How to start from example? © Copyright Obeo | 22 March, 2010
  3. 3. Acceleo Code Generation Let's start with an Android example This is a Quick Tutorial – My goals Beginners will see a simple but concrete case-study Acceleo addicts will discover some new killing features Android experts will learn enough of the basics to be able to create advanced code generator in a few days. As you will see, I'm not an Android expert... © Copyright Obeo | 22 March, 2010
  4. 4. Acceleo Code Generation Let's start with an Android example Prototype based approach – Starting from an example A classic example of Android application : « MyContacts » « We would like to be able to fully generate the same kind of application » MyContacts © Copyright Obeo | 22 March, 2010
  5. 5. Acceleo Code Generation Let's start with an Android example The prototype sources and the model Different kinds of sources to be generated! Java UI, Java DB, XML, properties... The model must contain all the specific settings of the application Android Activity, Entity Fields... One model element → « N » generated text parts © Copyright Obeo | 22 March, 2010
  6. 6. Acceleo Code Generation Let's start with an Android example Initialize the Android code generation project An MTL file for each kind of generated file © Copyright Obeo | 22 March, 2010
  7. 7. Acceleo Code Generation Let's start with an Android example Initialize the workflow – The main entry point An MTL file that calls the other ones... (Mentioned in the OMG specification) Java / MWE / ANT? Call the Java Standalone API to run the code generation! © Copyright Obeo | 22 March, 2010
  8. 8. Acceleo Code Generation Let's start with an Android example Editing the code generator – Quick replacement © Copyright Obeo | 22 March, 2010
  9. 9. Acceleo Code Generation Let's start with an Android example Editing the code generator – Quick hierarchy tree © Copyright Obeo | 22 March, 2010
  10. 10. Acceleo Code Generation Let's start with an Android example Run and test the generated version of the prototype MyContacts © Copyright Obeo | 22 March, 2010
  11. 11. Acceleo Code Generation Let's start with an Android example Run on other models to create new applications... © Copyright Obeo | 22 March, 2010
  12. 12. Acceleo Code Generation Let's start with an Android example A little bit about incremental generation « My web service is conserved when I generate the application again » → Defining specific coding zones with user tags [protected] → Using JMerge with the @generated annotation © Copyright Obeo | 22 March, 2010
  13. 13. Acceleo Code Generation Let's start with an Android example Workbench Acceleo views – Edit and maintain! The « Result View » to show how the text and the model are synchronized The « Overrides View » to override an existing template behavior The « Patterns View » to define your own completion proposal © Copyright Obeo | 22 March, 2010
  14. 14. Acceleo Code Generation Let's start with an Android example Conclusion Now you can make a complete Android code generator (more widgets...) We plan to have Acceleo graduate along with the Helios release Version 3.0 – The last stable release out of Eclipse was 2.x © Copyright Obeo | 22 March, 2010
  15. 15. Acceleo Code Generation Let's start with an Android example Jonathan Musset - jonathan.musset@obeo.fr Obeo 15

×