UML to Python/Java code generation
no.spam at thanks.com
Tue Jun 21 10:23:33 EDT 2005
"Magnus Lycka" <lycka at carmen.se> wrote in message
news:42B71FE6.1020107 at carmen.se...
> James wrote:
> > The brain may be fine for generating Python from UML but it is MANY
> > MANY orders of magnitude harder to generate UML from code with just
> > your brain than using a tool (usually zero effort and error free) no
> > matter how good you are at Python.
> I've really only used Rational Rose, but that tool is
> really limited in both directions. Class structure to
> class diagrams work both ways (not for Python, but for
> Java and C++ at least) but that's just a tiny part of
> I don't expect any tool to do anything meaningful about e.g.
> use case diagrams, but what about activity diagrams, sequence
> diagrams, collaboration diagrams and state diagrams?
> I agree that the brain is poor at such things, but I doubt
> that any current tool is much better except for trivial
> subsets of UML.
Have a look at Enterprise Architect from Sparx Systems
It is a really nice UML tool that is also affordable. I have also used
Rational Rose since about 96-97, and although it doesn't have Python support
for code generation, it most likely isn't a huge job to modify one of the
existing code generation templates (say the Java one) to generate Python
from the class diagrams.
Enterprise Architect has a separate free downloadble plug-in which can
Enterprise Architect is also much cheaper than Rose, and they can both do
C++ and Java.
Also, both of these tools have VBA/COM interfaces. What this means is that
you can control them and read data directly from them using the win32 python
I haven't tried it with EA, but a couple of years ago I wrote Python scripts
that controlled Rose.
I did stuff like creating UML diagrams on the fly including changing colours
and shapes, and also reading data from UML models. The Rose Extensibility
Interface (REI) is very well documented.
One could potentially write Python scripts coupled with some Python
introspection/reflection code to automatically generate and reverse engineer
(and document) Python <-> UML. It was always something I wanted to do but
never got around to it.
More information about the Python-list