[Uml-devel] codegenerator
Michał Śliwka
michal.sliwka at wp.pl
Sat Apr 26 03:08:04 UTC 2003
Dnia wto 22. kwiecień 2003 04:24, P. Fleury napisał:
> My suggestion does not imply round-tripping, because I do not
expect
> manual changes in the code to be reflected in Umbrello. Only if
I add
> something in Umbrello, it will be reflected in the code, after
> generation, but without wiping out what was there before. The real
> reason for this is that I tend to write my classes quite small,
and have
> accessors for many things, so these are all inline. This should
not be
> removed during code generation. But if I add a method in
Umbrello, I
> would like the code generation to add that method to the class.
However,
> if I add manually an accessor to my class, I will have to make the
> change in Umbrello too. I think this is not a big problem, as
we very
> well can manage having umbrello open in a window, and whatever
IDE or
> editor open in another window. The integration here is the kwin
part :-)
> In case of conflict, as your example mentions, I would let this
up to
> the user. There are graphical tools for that, especially if using a
> diff3 which can be presented with e.g. kompare.
> I know this is quite limiting, but with little effort we could
improve
> the usability quite a bit.
>
Maybe you know it...
There is UML-modeling tool for Windows, ClassBuilder. It supports
exactly what you've mentioned. This is done by 'user sections' in
generated code. Function bodies, parts of class definitions,
parts of *.h files outside class definitios - these are user
sections. In structures in which Umbrello holds schemes, could be
unique identifiers of user sections connected to particular
functions etc. Now, when we generating code, we generate it first
to memory, with user sections (empty), taked in braces (made with
commetns eg.
////umbrello-user-section-87687). We look for file with name like
this which we want to generate and look for user sections with ID
matching these in our new code in memory. Then we put appropriate
user sections from file to code in memory and write it all down
to file on disk.
And yet another thing - new unique ID are created when creating
new entity in umbrello (function, class, ...), when deleting
somenthing - we will never use its ID again, when only changing
something in entity (eg. in function parameters), we don't change
its user section ID, so generating code will not break eg.
function body.
I don't want to offend you if it all is obvious :-) (or I don't
see some hard details - I'm only trying to figure out how it's
done in ClassBuilder...)
regards,
Michal Sliwka
--------------------------------------------------------------------------
"ADAPTACJA" już w kinach! Nicolas Cage + Meryl Streep + Chris Cooper
PORYWAJĄCY THRILLER O KWIATACH DONICZKOWYCH! Nagrodzony Oscarem!
< http://www.adaptacja.vision.pl >
More information about the umbrello-devel
mailing list