home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / object / 3009 < prev    next >
Encoding:
Text File  |  1992-07-26  |  4.3 KB  |  91 lines

  1. Newsgroups: comp.object
  2. Path: sparky!uunet!darwin.sura.net!wupost!m.cs.uiuc.edu!johnson
  3. From: johnson@m.cs.uiuc.edu (Ralph Johnson)
  4. Subject: Re: SHlaer-Mellor OOA Model, Problem with definition of Object
  5. Message-ID: <1992Jul27.055045.19705@m.cs.uiuc.edu>
  6. Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL
  7. References: <1992Jul21.175138.18096@projtech.com>
  8. Date: Mon, 27 Jul 1992 05:50:45 GMT
  9. Lines: 80
  10.  
  11. sally@projtech.com (Sally Shlaer) writes:
  12.  
  13. >>> Now let us switch over into OOD land.  As I see it,
  14. >>> the word "class" today combines two ideas:
  15. >>>  +    the typical unspecified instance (I don't care which instance
  16. >>> you are thinking about, this operation works the same way on any 
  17. >instance).
  18. >>>  +    the collection of all existing instances (as in class data, 
  19. >iterators
  20. >>> and similar class methods)
  21.  
  22. >> {from Ralph]  I only use "class" for the first concept.
  23.  
  24. >OK.  Then I think this is what we are saying:  A typical unspecified 
  25. >instance is a class to Ralph (who I am taking to be a spokesman for 
  26. >OOD), and an object in S-M OOA.  OOA does not have a word for the 
  27. >collection of existing instances.
  28.  
  29. After thinking things over, I decided that class doesn't mean
  30. "typical unspecified instance" to me.  Class means "the set of
  31. all possible instances that have existed, exist, or might exist in the
  32. future".  For example, "Number" doesn't just mean all the numbers that
  33. I have written down, it means all the ones I could ever write down, and
  34. even the ones that I might theoretically write down if I could live forever.
  35. Class means "category", "type", or "group".  A class description describes 
  36. the category or group. 
  37.  
  38. Object means instance to me.  I don't use the word "instance" much.
  39. I might say that "x is an instance of class Y", but I would be more
  40. likely to say "x is a Y", because it is shorter and more natural, though
  41. a little less precise.  Thus, I would say "topView is a StandardSystemView".
  42. Note that topView is a *variable* that refers to some unknown instance of
  43. StandardSystemView, so this is not referring to a particular object, but
  44. to whatever object becomes referred to by topView.  I guess that means
  45. that when I want to refer to an unspecified instance, I use a variable.
  46.  
  47. >Questions:  1.  Do you have a word for the collection of existing 
  48. >instances?
  49.  
  50. No.  I might say that I keep a database of current employees, or
  51. something like that.  I find that most of the time I never need to
  52. know about all the existing instances.  Even if I have employee objects,
  53. I am only interested in the employees of one company.  It is better to
  54. model the collections explicitely, and not depend on any built-in notion
  55. of the collection of existing instances.  Of course, there are exceptions,
  56. but they don't happen enough to cause me to invent special terms.
  57.  
  58. >2.  What do you mean when you say "object"?  Can you answer in terms of  
  59. >"how many" and specified vs. unspecified -- or is there another 
  60. >dimension that we need to take into account? 
  61.  
  62. Object means one.  If I say "an employee" then I am referring to some
  63. unspecified employee, which might be in class Employee or in a subclass
  64. of Employee.
  65.  
  66. >3.  When you said "Like you, I consider a collection of instances to be 
  67. >an object", you were using the OOA definition of object -- right?
  68.  
  69. Nope.  I was just saying that collections can be objects, too.  Smalltalk
  70. even has a class Collection to represent collections.
  71.  
  72. >4.  When you said "Moreover, I don't consider a class to be an object 
  73. >during high level design", were you using the same or a different 
  74. >definition?  (This one has me somewhat more puzzled.)
  75.  
  76. In Smalltalk, a class is an object.  In C++, it isn't.  Some people
  77. think that there is magic in making a class an object.  Perhaps there
  78. is from a programming language implementor's point of view, but not from
  79. an application programmer's.  Application programmers make use of the
  80. fact that a class is an object to parameterize objects that create other
  81. objects with the classes of the objects that they create, and to define
  82. specialized instance creation operations, and that is about all.
  83.  
  84. It is possible to do funkier things than that, like adding code to
  85. classes on the fly, or creating new classes on the fly, but this is
  86. not common, and is certainly not normal programming.  It is metaprogramming.
  87.  
  88. By the way, the history was interesting.
  89.  
  90. Ralph Johnson -- University of Illinois at Urbana-Champaign
  91.