home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!rational.com!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Subject: Re: Booch question: new class relationship?
- Message-ID: <rmartin.728269221@thor>
- Sender: news@rational.com
- Organization: Rational
- References: <894@ulogic.UUCP> <rmartin.727740331@thor> <1993Jan28.204928.10352@rational.com>
- Date: Fri, 29 Jan 1993 01:00:21 GMT
- Lines: 47
-
- paul@melody.Rational.com (Paul Jasper) writes:
-
- |In article <rmartin.727740331@thor>, rmartin@Rational.COM (Bob Martin) writes:
-
- |> Containment by value represents the notion that the storage of the
- |> contained class exists within the storage of the containing class.
- |> The containing class has intrinsic knowledge of the contained class
- |> (ie. knows where to find it). The contained class is created and
- |> destroyed with the containing class.
-
- |Yes, this is correct, but then you add:
-
- |> The contained class cannot be polymorphic.
-
- |Tut, tut, Bob! You should know this ;^)
-
- |"Has by value" doesn't necessarily imply physical containment. The
- |"intrinsic knowledge" may still be a pointer or even a database reference,
- |but the semantics will still be that instances of the sub-class are
- |created and destroyed with the parent object.
-
- Ah! I think we are confusing containment by value with "Ownership". A
- class "owns" the object it contains if, upon its own death, it kills
- the contained object. This, however, IMHO is not containment by
- value. Containment by value is when the storage for the contained
- is within the storage for the containing. Certainly the
- containing class then "Owns" the contained class, since the contained
- object will die with the containing object. But is also means that
- the absolute type of the contained object is known, and so cannot be
- polymorphic.
-
- Containment by reference, on the other hand, can be polymorphic
- becuase it implies that the contining objects simply contains a
- pointer or a reference to the contained object. It is containment in
- that the containing object has intrinsic knowledge of the contained
- object. But it does not imply ownership since there is no guarantee
- that the containing object will destroy the contained object when it
- dies.
-
- To my knowldege, there is no notation for ownership in the Booch
- notation.
-
- --
- Robert Martin | Design Consulting | Training courses offered:
- R. C. M. Consulting | rmartin@rational.com | Object Oriented Analysis
- 2080 Cranbrook Rd. | Tel: (708) 918-1004 | Object Oriented Design
- Green Oaks, Il 60048| Fax: (708) 918-1023 | C++
-