home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / object / 4693 < prev    next >
Encoding:
Internet Message Format  |  1993-01-02  |  5.8 KB

  1. Path: sparky!uunet!pipex!bnr.co.uk!uknet!gdt!aber!fronta.aber.ac.uk!pcg
  2. From: pcg@aber.ac.uk (Piercarlo Grandi)
  3. Newsgroups: comp.object
  4. Subject: Re: A Pre-Release FAQ
  5. Message-ID: <PCG.93Jan2211415@decb.aber.ac.uk>
  6. Date: 2 Jan 93 21:14:15 GMT
  7. References: <1992Dec29.042355.10967@netcom.com> <PCG.92Dec29203617@decb.aber.ac.uk>
  8.     <37B01UW@minnie.zdv.uni-mainz.de> <PCG.93Jan1185311@decb.aber.ac.uk>
  9.     <11534@uqcspe.cs.uq.oz.au>
  10. Sender: news@aber.ac.uk (USENET news service)
  11. Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
  12. Organization: Prifysgol Cymru, Aberystwyth
  13. Lines: 110
  14. In-Reply-To: king@cs.uq.oz.au's message of 1 Jan 93 21: 56:57 GMT
  15. Nntp-Posting-Host: decb.aber.ac.uk
  16.  
  17. On 1 Jan 93 21:56:57 GMT, king@cs.uq.oz.au (Paul King) said:
  18.  
  19.   [Booch quote about difference between class and type ...]
  20.  
  21. king> (Piercarlo Grandi) writes:
  22.  
  23. pcg> Here I disagree vehemently with Booch. [ ... ]  Indeed such terms
  24. pcg> are so overloaded with different meanings and therefore so
  25. pcg> ambiguous that they should always be qualified; ideally there
  26. pcg> should be different word.
  27.  
  28. king> I did not find Booch's treatment of this subject that bad.
  29.  
  30. king> I do not believe there is a lot to be gained by placing too much
  31. king> emphasis on the difference between type and class (and I have read
  32. king> numerous articles on this topic - all of which still leave me
  33. king> unconvinced).
  34.  
  35. Well, I can try again; distinguishing between a denotation and its
  36. representation in a computer is vital in two respects:
  37.  
  38.     * to have a well founded understanding of what one is doing, a
  39.       fairly rare commodity. It can be argued that programmers don't
  40.       need to understand what they do, as long as it can be made to
  41.       work most of the time. To this I cannot offer any objection
  42.       (there is a large market for poor quality software developed
  43.       with the trial-error approach beloved by "mere mortals", a
  44.       very small one for robust software).
  45.  
  46.     * to know what kind of compromises one has done within
  47.       the representation (i.e. if one does not know clearly what
  48.       kind of type he was trying to represent one knows even
  49.       less what kind of type has actually been represented).
  50.  
  51. For example it is vital to know that in C the 'mode' unsigned does not
  52. correspond to the 'type' Naturals, and not even to the subset of
  53. Naturals up to 2^N-1, but to the type 'Naturals mod 2^N'.  Or that
  54. floating point numbers are (oh gosh, what I am saying) more similar to
  55. rationals than to reals. This can either be clear in the mind of he
  56. programmer, by knowing his types and classes, or it can be left as a
  57. fairly amusing suprise for the customer. The latter wins market share,
  58. the former does not.
  59.  
  60. king> I do however think it is useful to distinguish the
  61. king> level of abstraction one is working at when you use the terms.
  62.  
  63. Nitpicking: It is not really the level of abstraction, it is the
  64. *domain*; in each domain (denotations, representations) one can have
  65. several levels of abstraction, which need not even be linked one-to-one.
  66.  
  67. king> I prefer to use simple definitions (and qualify when necessary): a
  68. king> type is a set of values
  69.  
  70. Ahi, ahi, here you lose the 64k prize! A type is *not* a set of values,
  71. despite what poorly edited articles like Cardelli&Wegner's report. The
  72. operations one can do on a type are not limited to set operations. Also,
  73. two very different types can be about same set of values (e.g. subset of
  74. naturals from 0 to 2^N-1 and naturals modulo 2^n).
  75.  
  76. king> a class is one language construct that can be used to define a
  77. king> type (and in some languages the only construct)
  78.  
  79. Ahi, ahi, I am in nitpicking mode here! A class defines the
  80. *representation* of a type, not the type; types are usually defined in
  81. appropriate notations. See, it's easy to slip even for you, and even if
  82. you obviously know this well:
  83.  
  84. king> You can use classes from the implementation language to define the
  85. king> implementation type, and use classes from your favourite OO
  86. king> specification to define the abstract type.
  87.  
  88. If inaccurate expressions escape the attention of somebody who *knows*,
  89. just imagine the confusion they can generate in those that don't; I
  90. would say that you are very optimistic when writing:
  91.  
  92. king> If the level of abstraction is clear from the context then you can
  93. king> just refer to types and classes without qualification.
  94.  
  95. It gets all too easy to mix things in a confusing way; even a lot of the
  96. published literature is confused in exactly that way. I'd rather be
  97. extra fussy than extra sloppy:
  98.  
  99. king> (I believe this is Booch's point - most often the level of
  100. king> abstraction is clear from the context - though he didn't elaborate
  101. king> specifically).
  102.  
  103. I got a rather different impression; that he wants to sell OO
  104. consultancy, and the average customer does not want to be bothered with
  105. talk about things like domains of discourse and other dangerous and
  106. bolshevik innovation from pinko mathematically oriented guys. They want
  107. to make things that work and sell, just like GM cars (;-> or MS Windows,
  108. if you want a more successful example).
  109.  
  110. king> For objects, it doesn't usually matter whether you refer to their
  111. king> type or their class.  And if the class mechanism is the only way
  112. king> to define types, I would go so far as to say that the words type
  113. king> and class are interchangeable.
  114.  
  115. This is an extremely dangerous attitude; for example it makes a lot less
  116. obvious that a type/algebraic structure can be represented by many
  117. different but in that sense equivalent classes.
  118.  
  119. Confusing type and class eventually results in disgraces like the
  120. inability in most current OO languages to define in the same program
  121. different implementations for the same interface. These are not small
  122. consequences.
  123. --
  124. Piercarlo Grandi, Dept of CS, PC/UW@Aberystwyth <pcg@aber.ac.uk>
  125.   E l'italiano cantava, cantava. E le sue disperate invocazioni giunsero
  126.   alle orecchie del suo divino protettore, il dio della barzelletta
  127.