home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 3057 < prev    next >
Encoding:
Internet Message Format  |  1992-07-29  |  2.4 KB

  1. Xref: sparky comp.object:3057 comp.lang.eiffel:1019
  2. Newsgroups: comp.object,comp.lang.eiffel
  3. Path: sparky!uunet!wupost!usc!rpi!psinntp!psinntp!bony1!richieb
  4. From: richieb@bony1.bony.com (Richard Bielak)
  5. Subject: Commands and Queries (was Re: Class methods)
  6. Message-ID: <1992Jul29.124608.8707@bony1.bony.com>
  7. Organization: multi-cellular
  8. References: <5631@vexpert.dbai.tuwien.ac.at> <1992Jul28.150114.25065@bony1.bony.com> <STEINMAN.92Jul28184519@hawk.is.morgan.com>
  9. Date: Wed, 29 Jul 92 12:46:08 GMT
  10. Lines: 51
  11.  
  12. In article <STEINMAN.92Jul28184519@hawk.is.morgan.com> steinman@is.morgan.com (Jan Steinman) writes:
  13.  
  14. [...]
  15.  
  16. >I think the hang-up on queries or commands is getting in the way here,
  17. >as is the class-object distinction. Objects are created continuously
  18. >and rapidly; many messages need to return newly created objects, and
  19. >if you insist that only classes can return new objecs, you'll get in
  20. >trouble quick!
  21. >
  22.  
  23. Isn't "new" a class method in SmallTalk? 
  24.  
  25.  
  26. >If you must think in terms of categories of messages, how about adding
  27. >a third: "collaboration". aMan and aWoman collaborate to create aChild
  28. >-- they don't ask either Manness or Womanness to do it for them!
  29. >Likewise, "3" and "4" can collaborate to create "7", "1", or anything
  30. >else that is legal among consenting adults.
  31. >
  32.  
  33. One of the reasons why commands and queries are attractive, is that
  34. they extend nicely into the realm of concurrent objects. Since a query
  35. does not change the state of the object, many queries can be active
  36. within an object at the same time. On the other hand, only one command
  37. can run within an object, as it changes its state.
  38.  
  39. This distinction also fits nicely with Eiffel's assertion mechanism.
  40. The pre-, and post-conditions and the invariant remain valid in a
  41. concurrent object.
  42.  
  43. In your example of aMan and aWoman, who gets the message to create a
  44. child? I guess to be politically correct, the statement would be:
  45. aChild = [aWoman mate: aMan] ( ;-) ).
  46.  
  47. Collaboration is a nice idea, but even in your example, it doesn't
  48. tell me where to place the method. Or am I missing something?
  49.  
  50.  
  51. ...richie
  52.  
  53.  
  54. P.S. Shouldn't we have aChild = [Child dad: aMan mom: aWoman] ?
  55.  
  56.  
  57.  
  58. -- 
  59. * Richie Bielak   (212)-815-3072   | "Your brain is a liquid-cooled parallel  *
  60. * Internet:       richieb@bony.com | super-computer". He pointed to his nose, *
  61. * Bang {uupsi,uunet}!bony1!richieb | "This is the fan."                       *
  62. *    - Strictly my opinions -      |                     - David Chudnovsky - *
  63.