Hi everyone,
I just downloaded the current draft for "JSR 250 - Common Annotations
for The Java Platform" and noticed that one of the things I believe
could really be great with annotations was missing.
As far as I know, there is no way to represent in Java or in any
language I've programmed so far that a relationship between two or
more objects is an aggregation, association or composition (ok, some
languages such as C++ provides a reference/value mechanism that makes
this no that hard, but it's still not the point).
Seems like some tools (e.g.
http://www.modelistic.com/website/userGuide/diagrams/Associations.html
) mark these relationships using doclets. Using this, some tool can
discover association roles given source files. As we all know much was
done through doclets and annotations are here to bring all this
information to runtime, when needed.
I think that this information can be really useful as documentation
for the code, and can really help EJB3/Hibernate, IoC containers,
Application Servers and other tools handling user objects' lifecycle.
It will be known that when an object is removed from a cache, updated,
deleted, created or something, all its relationships should be
evaluated, maybe deleting some compositions or doing some related
stuff.
This said, I suggest that you include in the specification annotations
for classic (and UML/OMG specified) object relationships between
objects (Aggregation, Association and Composition at least).
Just as I believe annotations can be great to bring UML stereotypes to
the real world, I believe people (and specially CASE tools) will use
an approach like this to document these relationships. I believe that
the objective of this JSR is to provide standard annotations, so it
would be no good if we have each vendor creating its own set of
annotations to document relationships.
Thanks for your time and regards,
--
Phillip Calçado
http://www.fragmental.com.br
ICQ: 1110nine38six5
M$N:
pcalcado@gmail.com
Y!:
pcalcado@yahoo.com
Crux Sacra Sit Mihi Lux