[Uml-devel] kdesdk/umbrello/umbrello/codegenerators

Gustavo M. linux_news at nextphere.com
Thu Apr 3 11:27:15 UTC 2003


Hi guys,

I want to thank you for your amazing work with umbrello. 
We use it in our company since version 1.0.3 (when it was called uml object 
modeller). The following is what we think regarding code generators.

What do we expect from umbrello and codegenerators:
	1- umbrello should be able to generate code in several languages (already 
done! :-D )
	2- I should be able to make changes to the code with any editor/IDE I want 
to, and the changes should be reflected in my diagrams.
	3- I should be able to make changes to my diagrams and umbrello should 
reflect those changes in the code without overwriting any method bodies.
	4- From a QA point of view, I am very interested in codegenerators because 
they would allow me to help standarize coding (required methods, 
documentation style, license info, templates, etc). For example if the 
company´s standard for C++ requires every class to have a ToXML method I can 
write my own codegenerator to implement it, that way I will not need to write 
it myself in umbrello. Later I would synchronize the diagrams with the code.
In the future some of this maybe can be move to a code generation preferences 
dialog, but that is for another wish list.
	5- It would be nice if I could write a codegenerator as an .so lib and add it 
to umbrello in runtime.
	6- Advanced codegenerators could rely on third party software to do their 
work without imposing more dependencies to the main umbrello project.

On Thursday 03 April 2003 01:41, Sebastian Stein wrote:
> Brian Thomas <thomas at mail630.gsfc.nasa.gov> [030403 09:19]:
> > > I don't think the user should be able to edit anything within Umbrello,
> > > there are already plenty of text editors and IDEs to be able to do
> > > that. Just being able to select the configuration options that the code
> > > generator provides would make sence.  And if you could get it so it
> > > doesn't overwrite code that's already there, that would be quite
> > > impressive.

I agree, you should not bind a user to a specific editor/IDE. Plus, there is 
no reason to reinvent the wheel.

>
> I think there are different approaches. The perfect thing would be:
>
> - generate code in Umbrello
> - edit the code with an editor/IDE
> - Umbrello notices the code changes and updates the entire modell (maybe
> add a new class or rename something)
>
> I'm not if we could do this, I think it might be impossible.

I think when umbrello loads up a project file it could check for the generated 
file timestamps and if necesary synchronize the diagrams (maybe ask the user 
before?). And also add a menu option to manually synchronize diagrams with 
code. The general CodeGenerator class can keep a file with the timestamp data 
for each generated file.

When a diagram changes code needs to be upgraded without overwriting current 
method bodies. I can think a couple of methods to do this, but why not leave 
this up to the codegenerator itself. I have not read the specific umbrello 
code, but if a file has been generated before it should not be overwrited 
before telling the codegenerator to write classes or methodsa again, etc. 
That way the codegenerator can pick the method bodies and merge them with the 
new class and method definitions.

Maybe we can use commented tags to identify methods, for example for c++:

//@ClassIdentifier::MethodIdentifier_BEGIN@
Method ... bla bla
//@ClassIdentifier::MethodIdentifier_BEGIN@
{
...
}

or maybe we can use some CTAGS (http://ctags.sourceforge.net) information to 
do it. This is the one I like the most.

Any way, after some time letting codegenerators to deal with method 
overwriting it should be clear which way to go and then move it to the 
general CodeGenerator class. 

>
> But there are other solutions as well. Like that one:
>
> - generate code in Umbrello
> - edit the code with an editor/IDE
> - reload code in Umbrello and diff it to the generated one
>
> So Umbrello would generate internal the code again and diff it against the
> given (maybe edited one) one. There would be a lot of code parts not done
> in Umbrello and than Umbrello could try to handle this code.

Can this aproach prevent method implementations from being deleted?

Regards,

-- 
P. Eng. Gustavo Madrigal
Technology Research Department Manager
Nextphere Corp.
        Providing the Next Software Sphere
http://www.nextphere.com

P.D:As of this writing I am very tied with my schedule, but as soon as I get 
some time I will donate it to the project. So if this item is still open I 
will do some work on it.





More information about the umbrello-devel mailing list