Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: AnnHorton on April 05, 2002, 04:31:31 pm
-
I have a java servlet which creates an instance of another class in one of its methods. I had expected to see that reverse engineering the code would capture an association between the two classes.
But apparently with UML, the concept of association or aggregation only applies when a class needs to 'retain' a link to a dependent object -- as an instance variable.
After much 'digging', I think I had discovered that it would be appropriate to model the relationship between those two classes as a dependency relationship. Or is it more "correct" just to not model a relationship between them?
Thanks!
Ann Horton (a registered new user)
-
Hi Ann,
You are correct - EA does not generate an association link from a local variable within a method's execution.
You can model this both using a dependency relationship, possibly with an 'instantiates' stereotype, and also within Sequence and Collaboration diagrams where you capture the flow of messages between objects at runtime.
Should you use either or both of these in practice? I think the modelling of Sequence or Collaboration messages would be a definite yes, and the dependency a yes if you were keen to track the dependencies between elements for impact analysis, maintenance etc.
Just my opinion, someone else may see it differently,
Geoff Sparks
-
Ann,
I'm a newbie to the world of UML, but I think you are correct.
My interpretation of the notion of a dependency relationship is that if one class might be affacted by changes in another class, the first class should be noted as a depend on the second.
I think the idea is that these dependencies could then be used as part of a make process or build process to identify which files need to be recompiled as part of a build.
In the Java world, it seems that there isn't quite as much need for this sort of stuff because the java compiler does a pretty good job of recompiling based on dependencies. But I can imagine it would be useful.