Table Of Contents

Previous topic

Users Documentation

Next topic

Generating Python Code and Eggs

This Page

Foundations - UML, Profiles, AGX-Generators and more

UML - the Unified Modeling Language

UML - the Unified Modelling Language - is a graphical language designed to describe software through diagrams. There are several different types of diagrams available, but at the moment AGX uses only class-diagrams.

Class diagrams are used to draw i.e. packages (python packages or modules), classes (python-classes) and as well its properties (attributes) and operations (methods) on these. In addition, associations in the diagram show how objects are aggregated within or referenced from one another.

The goal of model-driven development is to create the “blueprints” for your software in a well-defined, easily-communicated format: the UML model and diagram thereof. You can design your model using visual tools until you have a structure which adequately represents your needs. AGX will generate the necessary code.

You probably have to customize that code somewhat, filling in method bodies, creating additional web-templates for your framework of choice etc., but AGX takes care of all the boilerplate for you.

With tagged values and stereotypes you can customize the generated code with a surprising degree of flexibility and control. When you need to hand-code something, AGX keeps your code if you follow some simple rules.

This manual does not aim to teach you UML and object-oriented, model-driven software development. There are several other fine manuals about that on the web. A very good starting point is the OMG UML Resource Page including its web-links to tutorials. For a quick-start reading Practical UML helps.

UML Profiles

AGX makes use of UML2 and its profiles.

A profile in the Unified Modeling Language (UML) provides a generic extension mechanism for customizing UML models for particular domains and platforms. Extension mechanisms allow refining standard semantics in strictly additive manner, so that they can’t contradict standard semantics.

Profiles are defined using stereotypes, tag definitions, and constraints that are applied to specific model elements, such as Classes, Attributes, Operations, and Activities. A Profile is a collection of such extensions that collectively customize UML for a particular domain.

from Wikipedia at 2010-07-08 Profile (UML)

AGX provides a specific profile for each generator package. I.e. the pyegg profile contains support for packages, modules, decorators etc. by providing stereotypes and tagged values.

AGX is extensible this way: Each generator addresses one specific domain and provides a profile for this domain. Generators and profiles may depend on a more basic doamin. I.e. the ZCA-generator (Zope Component Architecture) extends the pyegg-generator.

How does it work?

While creating an UML model author applies desired domain specific profiles. In profiles available stereotypes and tagged values for the domain are provided. After creating a diagram with domain specific information set on the elements AGX is invoked and code is generated.

While AGX is running, domain specific generators are working in in sequence. Each generator reads the same source tree and writes to the same target tree, i.e. from a UML model to a tree of files. A domain specific generator could be for Python eggs, Zope Component Architecture with its ZCML configuration, GenericSetup profiles, Django specific profiles or any other framework.

Each generator extends or modifies the target tree to fit it’s needs. During the whole transformation process the target tree is held in memory. After the generators done their work, the target tree dumps the data to the file system. For more information about the generation process see section Under the hood.