home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.object
- Path: sparky!uunet!spool.mu.edu!enterpoop.mit.edu!bloom-picayune.mit.edu!space.mit.edu!berczuk
- From: berczuk@space.mit.edu (Steve Berczuk)
- Subject: Re: Booch question: new class relationship?
- Message-ID: <1993Jan21.170956.28545@athena.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: plantagenet.mit.edu
- Organization: MIT Center for Space Research
- References: <894@ulogic.UUCP>
- Date: Thu, 21 Jan 1993 17:09:56 GMT
- Lines: 33
-
- >> hartman@ulogic.UUCP (Richard M. Hartman) says:
- |> However a child window frequently has to know about the parent
- |> window. And may be passed a pointer to it's parent in the constructor,
- |> which it stores internally & may make use of in various ways. BUT
- |> this pointer is something that the child window must NOT screw around
- |> with in any serious way. It can't reallocate it, it can't destroy it
- |> in it's destructor. It "has" a parent, but it is not "in control" of
- |> it. This is what I am calling "knows-a". It is a form of "uses" in
- |> the Booch system, but I think that the distinction between this and
- |> the OTHER kind of uses (has-a) is both significant and not currently
- |> represented in any formal OO Design system that I have seen.
- |>
- my first reaction is to say that this is just a has-a (or "uses"),
- albeit a has-a of a shared reference.
-
- to take another example, a class Employee might have a "is-supervised
- by" relationship with a Manager object that may be implemented as a pointer to a
- manager object. (ie, the employee Uses the manager object for some function)
- When the employee is "removed" the Manager most likely isn't and
- this protocol should be enforced by the employee destructor..
-
- I think the distinction between "has-a" and "knows-a" is good to keep in mind, but
- adding it explicitly to a design methodology could make things ugly, as issues such
- as ownership of the object for allocation, destruction, etc can be very
- implementation specific (the Manager can be reference counted, say, and the
- employee objects DO delete it but it only goes away when there are no employees to
- supervise...
-
-
- --
- Steve Berczuk berczuk@mit.edu
- MIT Center for Space Research (617) 253-3840
-
-