home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / object / 4561 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  4.8 KB

  1. Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!ukulele!eaker
  2. From: eaker@ukulele.crd.ge.com (Chuck Eaker)
  3. Newsgroups: comp.object
  4. Subject: Re: Object hidden state and side effects
  5. Message-ID: <1992Dec17.001046.27321@crd.ge.com>
  6. Date: 17 Dec 92 00:10:46 GMT
  7. References: <1992Dec14.175402.1889@crd.ge.com> <1992Dec15.143243.16256@heeg.de> <1992Dec15.224536.13554@crd.ge.com> <BzC05w.2xA@newsflash.concordia.ca>
  8. Sender: eaker@ukulele (Chuck Eaker)
  9. Organization: GE Corporate R&D Center
  10. Lines: 84
  11. Nntp-Posting-Host: ukulele.crd.ge.com
  12.  
  13. In article <BzC05w.2xA@newsflash.concordia.ca>, grogono@cs.concordia.ca (Peter Grogono) writes:
  14. |> In article <1992Dec15.224536.13554@crd.ge.com> eaker@ukulele.crd.ge.com (Chuck Eaker) writes:
  15. |> >In article <1992Dec15.143243.16256@heeg.de>, hasko@heeg.de (Hasko Heinecke) writes:
  16. |> >|> In article <1992Dec14.175402.1889@crd.ge.com> eaker@ukulele.crd.ge.com (Chuck Eaker) writes:
  17. |> >|> >The point is that computers cannot use "the *real* 3/4."
  18. |> >|> 
  19. |> >|> You wanted philosophy, so here it is: What *is* the real 3/4. What would
  20. |> >|> Immanuel Kant say?
  21. |> >
  22. |> >I'm sure Kant and other philosophers would agree that 3/4 is a rational
  23. |> >number, and that whatever the nature of its existence, there is only
  24. |> >one such number, it cannot be created, destroyed, copied, or changed
  25. |> >in any way. Unlike philosophers, we don't have to worry about "realms"
  26. |> > ............
  27. |> 
  28. |> I suggest we all go and re-read \cite{Whitehead:1910} and then resume 
  29. |> the conversation.
  30. |> 
  31. |> @book{Whitehead:1910
  32. |>          author = "A.N. Whitehead and B. Russell",
  33. |>          title = "Principia Mathematica",
  34. |>          publisher = "Cambridge University Press",
  35. |>          date = "1910--13"}
  36. |> 
  37. |> Peter
  38.  
  39. I'd rather just summerize from memory: the symbol "2", for example,
  40. denotes the class of all couples. And that's about all in those
  41. three volumes that strikes me as being relevant to the discussion.
  42. Other plausible interpretations are that "2" denotes a point on the
  43. number line. But whatever theory (interpretation) you choose, it
  44. had better have as a consequence that the denoted thing is unique
  45. and can't be created or destroyed, etc. And all of this is true of
  46. the class of all couples just as it is true of the class of all
  47. zero-tuples (the null class).
  48.  
  49. What's the point of all this? We populate our applications with
  50. "ordinary objects" which are things that come and go and whose
  51. attributes take on different values during the life of the
  52. application. Unfortunately, we are forced to use the same ordinary
  53. object construction mechanism to model domains of values. The
  54. potential danger in this "optimization" (or re-use, perhaps) is
  55. that our application could well end up incorrectly modeling
  56. whatever its domain is in dangerous ways.
  57.  
  58. Here is a simple example. Suppose we have a Thing class which has
  59. an attribute, call it imbalance, and its current value must be from
  60. the domain of imaginary numbers. If we implement this domain as
  61. instances of a class that we create on the fly as needed, we could
  62. well have multiple instances of the same imaginary number around. 
  63. Thus, it is possible to confuse tests for identity with tests for
  64. equality.  But ordinary people don't think of this as being
  65. possible with imaginary numbers because two imaginary numbers are
  66. identical iff they are equal. Unlike our implementation, the
  67. statement 1+2i = 1+2i has a single meaning. Consequently, they
  68. never think to protect themselves against these possibilities which
  69. only arise because of our inappropriate implementation of a value
  70. domain.
  71.  
  72. Very good object-oriented developers do understand all of this. 
  73. They are very careful to build value domain classes so that invalid
  74. operations can't be performed on them (provided people use them as
  75. advertised). But in my experience, many of the really nasty
  76. problems with complex object-oriented systems have been the result
  77. of not being able to completely maintain and cover up the "big
  78. lie": that an ordinary class mechanism is being used to implement a
  79. value domain which means that certain kinds of inappropriate
  80. operations can, and were, performed on values. (I suspect that
  81. the big lie may be behind most memory leaks.)
  82.  
  83. So, I don't think it is a good idea to pretend that a value is an
  84. object even though we generally get away with it. Furthermore, it
  85. strikes me as most peculiar to say: "Sending the message +2 to the
  86. object 3 yields the new number 5." Yet our tools encourage us to
  87. talk this way. I'm not convinced that this is helping us push the
  88. level of abstraction at which we work closer to that of application
  89. domains. Application domain people don't talk like this at all. 
  90. Send messages to objects, not to values.  The ideal tool would
  91. allow us to implement value domains without these risks and without
  92. having to speak in convoluted ways.
  93.  
  94. -- 
  95. Chuck Eaker / P.O. Box 8, K-1 3C12 / Schenectady, NY 12301 USA
  96. eaker@crd.ge.com        eaker@crdgw1.UUCP       (518) 387-5964
  97.