Basic idea
It is quite easy to implement a code generator with a language that manipulate strings easily, like interpreted languages.
On the other hand, a module for argoUML is not a trivial work.
So, the idea is to take the time to make a generator module as simple
as possible, generating a neutral code that can be easily interpreted
(why not then generating a script). After this, the real generation is
delegated to another process in interpreted mode, more flexible.
Benefits
- you can make or customize your own generator which fits exactly your needs, without any knowledge of ArgoUML internals or API.
- the complexity of the generator is delegated to an external tool (merging generated an manual code).
- generator code easy to implement, with your prefered script language: tcl, python, ...
Some ideas for the implementation:
- Tcl or python for the script file
- target languages for generation: incrTcl, python; and any language not supported by other tools: F90, ADA
Use case
- I write a diagram class with ArgoUML
- I launch the code generation process : the result is a script file, written in my favorite scripting language (for example, tcl)
- I choose a generation package for the target language; if it does
not exist yet, I do it myself, because it is so easy (I enjoy to
code with tcl :-))
- the generated script is easy to understand, self-documented:
# generated script: do not edit
class Class1 -inherit {BaseClass1 BaseClass2} -implements {Interface1}
Class1 attributes {
{aLong long 0 private}
{name string "anonymous" public}
}
Class1 methods {
{getName string {} public}
}
Class1 associations {...}
interface Interface1 {...}
Interface1 methods {...}
...
- I execute the script: the classes are generated.