Re: aggregation and states



Date view Thread view Subject view Author view Attachment view

From: Ulf Schuenemann (ulf@cs.mun.ca)
Date: Tue 11 Jun 2002 - 00:29:53 BST


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

Date view Thread view Subject view Author view Attachment view