[Modeling] Modeling an Agent Class- register your opinion

Stephen Cranefield scranefield@infoscience.otago.ac.nz
Fri, 27 Jun 2003 10:47:18 +1200

Hong Zhu wrote:
> In my example of departments, the employees do exist after the department
> destroyed. The difference for each employ is their membership to the
> i.e. the change from a memebr to non-member. This has nothing to do with
> lifetime, and has nothing to do with sharedness. It is the change of
> that make things different.


I don't understand why you want to model the employee-employer relationship
as an object-class relationship.  To me, this is a bad choice and explains
why you think there is a problem here.  If you model it as a association
(whether composite or aggregate) then the problem goes away.

Also, I think of UML's part-whole relationships as static modelling
UML doesn't have anything to say about the dynamic aspects of these
relationships, except to say that a composite has "responsibility for the
existence and storage of the composed objects".  I think this is the right
way to go.  Your idea of congregation seems to be an attempt to provide a
whole-part relationship that has dynamic as well as static semantics.  In
my opinion, it would be better to keep these aspects of modelling orthogonal
and provide appropriate constraints that can be added to aggregations or
compositions to assert relationships between the lifetimes of the composite
and the parts.

> Even so, the relationships between a fire station and fire engines should 
> be aggregate, rather than composite.

No, composition is the correct choice, as I am assuming that fire engines
are assigned to a single station and can't be shared by stations.

- Stephen