home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / object / 4974 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.1 KB  |  46 lines

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