Plone3 & Acceleo, the first step

I have work some hours on a simple plone2.5 code generator with Acceleo. It is available on the acceleo svn:

svn checkout svn://svn.forge.objectweb.org/svnroot/acceleo/trunk/modules/community/uml21/zope/plone/25/org.acceleo.module.pim.uml21.plone25/trunk

This code generator is not finished, but the way of doing is good enought to start the plone3 one. I would like here to explain the purpose of the Acceleo Generator for Plone3 i want to make.I will first explain the problems i have with ArchgenXML.

What i don’t like in AGX:

  • The license in each source file (i prefer just a license.txt file)
  • The billion tagged values (i have lost hours here)
  • The generated code itself doesn’t look like with the code i would have produced.
  • The command line
  • ArgoUML
  • All the hacks done every where to make the code compatible with two versions of Plone
  • You can’t modify a line of code generated without lost it if you re-generate your code

What i like in AGX:

  • The way you use UML (copy the model, and then do a simple class diagram, it s up)
  • The i18nized schema generated with po files
  • The generated tests
  • It works on all well known OS (linux, macos, windows)
  • Lots of documentation
  • The user code slots well thought.

For sure i want to keep all that good point for the project. So the overview of what i want:

  • Easy to install and to use
  • Running on most OS known
  • Code template easy to customize (making multiple branches of my own templates)
  • Do not generate 100% of the code by working hours in your UML diagrams
  • Be able to get an existing UML and generate only what you want

An other point: generate something only if it save your time. The best example i have is tagged values from AGX, like Searchable = 1. One tagged value for one line of code !A first advice from Cédric Brun (obeo) is to don’t fall in the modelisation of the code itself. For example doing an UML component to generate a zope component (BrowserView, adapter, …). In that case you will lost a lot of time in doing you UML diagram, and be obliged to add stereotypes (adapter, …). So to follow this advice, i have think about the idea of using Component diagram from UML, and i finally don’t want to use it, cause for me an UML component is not equal to a zope component. A UML component can be more seen as an egg. I need to think a bit more about that point, but that could be a great aspect to zope code generation.

Would we need to ‘model’ workflow and generate them according to a state diagram ? Here the point is a bit more complex. In fact you know that you need to make them to explain to your customers the need of specify workflows by UML. But the permission system in zope is specific to it, and the state diagram is not suppose to support this (in AGX we use tagged value one more time). And since we use GenericSetup to specify workflow now, the time saved by doing the state diagram for your workflow is negative. So i think we will just generate the state, but not the permissions associated, that are often explain with the diagram in a documentation. But i would like to generate the test associated with workflows. There were a good conference at Naple on that point.

Next, do we force the use of stereotypes to generate stuff or do we do as with AGX, and so force the use of ‘stub’ stereotype to indicate the generator that this class is not a content type to generate. I personally prefer the first option. In that way you can take an existing UML diagram, load the plone3 profile, and said this package is an egg, this class is a ATContentType.

Well, a good demo package to do is the case of the Martin Aspeli ‘s book.

Next time i will publish the UML from what i want the martin’s code to be generated.

Advertisements

2 Responses to “Plone3 & Acceleo, the first step”

  1. You don’t like :

    > The license in each source file (i prefer just a license.txt file)

    We need to copy license summary on each field for GPL to ensure that someone that find a file alone cannot say:
    “Oh, I didn’t know that file was protected by GPL !”
    I prefer the DSSL: Demerden Sie Sich Licence

    > The billion tagged values (i have lost hours here)

    ArchGenXML (and Genesis) want to make to more things from poor data. the best way to play with tagged values should be reverse-engineering on code that fill them automatically.

    > The command line

    You like buildout, don’t you? :)
    The advantage of the command line is to not be englued with an editor or an IDE. But like buildout do, it should be better to generate only a skel from command line instead of reinvent the wheel.

    > ArgoUML

    Use Poseidon or Apollo for Eclipse ;^)

    > All the hacks done every where to make the code compatible with two versions of Plone

    Just wait for Plone 4 0:^)

    > You can’t modify a line of code generated without lost it if you re-generate your code

    Yes, this one is very important and it is link to tagged values and reverse engineering.

    On workflows: I’m mainly agree with you. Keep in mind that DCWorkflow won’t live for ever and making simple task would make evolution easier.

    On your template: You should add a doc folder to centralized documentation ;)

    Please, before to write an advanced example show us how to install and configure this in eclipse and in a PyDev project.

    I will be yours in Paris sprint.

  2. >Please, before to write an advanced example show us how to install and configure this in eclipse and in a PyDev project.

    I think a bundle will be more convenient don’t you

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: