Re: Re: aggregation and states



Date view Thread view Subject view Author view Attachment view

From: Les Munday (baldrick@ureach.com)
Date: Tue 11 Jun 2002 - 01:52:16 BST


If I state in an object model that an engine has no meaning 
outside of the car in which it resides, i.e. the engine cannot 
exist before of after the car, it is part of a car. Or another 
way to think of it, is that the car is being decomposed into 
smaller classes in order to partition its functionality. I 
don't think that the car has to bnecessarily create and delete 
the engine, but the car has to be responsible, i.e. it 
initiates its creation and deletion. 

If the engine is a separate entity in my model that may exist 
outside of the lifecycle of the car to which it is attached, 
then some other class must have responsibility for its creation 
and deletion.

This is my take on the difference. The question is "how does 
this affect the code, or to put it another way, is it necessary 
to know about the difference at the code level"?

Les.


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On Mon, 10 Jun 2002, Ulf Schuenemann (ulf@cs.mun.ca) wrote:

> In "A foundation for composition" [JOOP 7(6) 1994], Bock and 
Odell
> gave an interesting account of composite objects: Every class 
Car,
> Submarine, etc composed with a class Engine implicitly 
introduces a
> "qua-class" (they say "qua-type") Car-Engine, Submarine-
Engine. These
> are the classes of the objects which *are* components in 
respective
> composites. The qua-classes may take part in different 
relationships:
> 
>   "For ex. a car uses an engine to power the wheels, whereas a
>   submarine uses an egine to power the propeller. ...
>   The powers relsh is restricted to relating CarEngine and 
Wheel (or
>   CarWheel) objects when dealing with cars, whereas for
>   SubmarineEngine the restriction is to Propeller."
> 
>   "... a composite object type [composite class] can be 
thought of as
>   defining a collection of qua-types related to each other."
> 
> In UML:
> 
>   +-----------------------------------------------------+
>   |                        Car                          |
>   +-----------------------------------------------------+
>   |                       powers                        |
>   | [theengine:Engine 1] --------- [frontWheel:Wheel 2] |
>   |                                                     |
>   |                 [rearWheel:Wheel 2]                 |
>   |                 [reserveWheel:Wheel 0..1]           |
>   +-----------------------------------------------------+
> 
>   +-------------------------------------------------------+
>   |                     Submarine                         |
>   +-------------------------------------------------------+
>   |                        powers                         |
>   | [mainengine:Engine 1] -------- [mainprop:Propeller 1] |
>   +-------------------------------------------------------+
> 
>   +--------+  +---------+  +-----------+
>   | Engine |  | Wheel   |  | Propeller |
>   +--------+  +---------+  +-----------+
>   | maxpow.|  | profile |  | numblades |
>   +--------+  +---------+  +-----------+
> 
> Just my $.02
> 
> Ulf
> 
> 
> 
> To remove yourself from this list please mail puml-list-
request@cs.york.ac.uk
> with a message containing the word "unsubscribe".
> 
> 
> 

Date view Thread view Subject view Author view Attachment view