[Uml-devel] kdesdk/umbrello/umbrello
Andrew Sutton
ansutton at kent.edu
Mon Feb 24 12:55:37 UTC 2003
On Monday 24 February 2003 3:01 pm, Mathias Meyer wrote:
>
> > They're called Paramaterised Classes in UML. Java calls the
> > Generics, or will do when they exist.
>
> I meant the XMI/UML DTD not UML in general. I was really looking forward
> to having support for them in Umbrello and now here we are, looking
> better than Argo and Poseidon ;)
> One obvious way to come around the template problem are stereotypes, but
> why use them when there's support for templates in UML.
the 2.0 object model supports them alread :) of course, the 2.0 UML object
model is also around 500 classes. not that this has any bearing on what
you're talking about, i just thought i'd throw that out there... ;)
actually, they aren't REALLY called parameterized classes. you can
theoretically paramaterize almost anything UML (like operations, states, use
cases). i'm not sure how much sense that makes, but its possible. anyways,
the result of defining template parameters for a class makes it a
parameterized class - they don't really exist by themselves.
on a related note - if anybody's going to do any work for this - here's how
templates in UML are supposed to work. something (lets call it UMLClass in
this case) has a list of template parameters. if that list is NOT empty, then
the UMLClass becomes a "template". i.e., it cannot be used like a regular
class (can't be used in inheritance or as types of other objects like
attributes or parameters). you have to define a special object called a
"binding" (or UMLBinding) that contains values for the template parameters of
the template class. this new object (the UMLBinding) can then be used like a
regular class. does that makes sense?
put another way, if a class has template parameters, you can't use it - just
like you can't use C++ templates without arguments for the parameters. the
act of creating the binding is similar to a typedef in C++:
typedef std::list<std::string> StringList;
now i can use StringList like a class.
if somebody were actually going to implement this, here's what i'd suggest for
XMI storage: use the same (or similar) mechanism as how you store parameters
for a method. as for the UMLBinding object, you could just store arguments to
the template parameters as strings - i don't think it would need to be much
more complex than that.
> Are those Generics a planned feature for Java? And is the whole world
> programming Java or what? ;)))
yes. apparently, we've all missed the boat :) i think what jonathan is
describing is the inclusion of template programming (i.e., generic
programming) into the java language.
andy
More information about the umbrello-devel
mailing list