Thursday, September 28, 2006

openarchitectureware

I have been using openarchitectureware for several months now and I am becoming a convert to MDA and code generation. Here are the basic steps I have taken to create a user interface tool using Eclipse:
  1. Created an Ecore (EMF) model that represented the UI meta-model. This model includes classes like "webapp", "page", "field", "checkbox", etc.
  2. Generated an EMF "GenModel" from the ecore. This is an automated step.
  3. Generated Java classes and an Eclipse editor for the model.
  4. Installed the editor into Eclipse. This default editor lets you edit your domain-specific model in a tree-view / property sheet kind of editor that you frequently see in Eclipse.
  5. Created a domain-specific model to represent a sample application. Create some pages, insert some sections, fields, buttons, etc. (All these things are classes in the meta-model).
So far so good? Everything I have described to this point is basic Eclipse with EMF. Now enters openarchitecureware (OAW):

OAW introduces the concept of a "workflow", which is an XML doc that describes the steps to be taken in the workflow. A basic workflow is:
  1. Parse the model XML using an OAW-supplied XmiReader.
  2. Run a Check that incorporates custom validation of the model.
  3. Run code generation using the OAW-supplied "Xpand2" template language.
  4. Enjoy fruits of labor.
Before you can complete step 4, however, you must write the code generation macros in the Xpand2 language. Xpand2 is a very powerful template language that can produce pretty much any textual output (e.g. Java source code, XML, HTML, Javascript, etc., etc. ) Xpand2 supports polymorphism in that you may supply macros for a type and then overload the macro for subtypes. Quite powerful and very enjoyable to work with.

As a further note, EMF is not the only form of meta-model that OAW can operate on- it also supports a Java Bean model, but I have only used EMF.

Saturday, September 02, 2006

Levitation

See me levitate using the power of my mind.