home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / object / 3247 < prev    next >
Encoding:
Text File  |  1992-08-18  |  11.6 KB  |  246 lines

  1. Path: sparky!uunet!mcsun!uknet!gdt!aber!aberfa!pcg
  2. From: pcg@aber.ac.uk (Piercarlo Grandi)
  3. Newsgroups: comp.object
  4. Subject: Re: O.M() versus M(O) notation
  5. Message-ID: <PCG.92Aug18161744@aberdb.aber.ac.uk>
  6. Date: 18 Aug 92 16:17:44 GMT
  7. References: <1992Aug5.162329.22871@ucunix.san.uc.edu> <PCG.92Aug12205741@aberdb.aber.ac.uk>
  8.     <__5mtrq.objsys@netcom.com> <PCG.92Aug14170701@aberdb.aber.ac.uk>
  9.     <1992Aug15.124149.28538@m.cs.uiuc.edu>
  10.     <PCG.92Aug16184526@aberdb.aber.ac.uk>
  11.     <DOUG.92Aug16200024@monet.ad
  12. Sender: news@aber.ac.uk (USENET news service)
  13. Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
  14. Organization: Prifysgol Cymru, Aberystwyth
  15. Lines: 227
  16. In-Reply-To: doug@monet.ads.com's message of 17 Aug 92 04: 00:24 GMT
  17. Nntp-Posting-Host: aberdb
  18.  
  19. On 17 Aug 92 04:00:24 GMT, doug@monet.ads.com (Doug Morgan) said:
  20.  
  21. doug> Of the popular OO books I have looked through, I only
  22. doug> remember Meyer's OOSC as even hinting at the subject with any sort
  23. doug> of internal consistency and abstraction.
  24.  
  25. Ah, yes. One may or may not agree with Meyer but at least he has
  26. somewhat clear ideas. I even somewhat liked the similar (and competing)
  27. book by Cox, even if the slant is very much different.
  28.  
  29. pcg> type denotation:    the algebraic structure; [ ... ]
  30.  
  31. pcg> I would personally use 'type' alone for the 'type denotation', [
  32. pcg> ... ]
  33.  
  34. doug> Your personal usage of "type" is better than "type denotation."
  35. doug> If an adjective is ever needed it should probably be more like
  36. doug> "denoted type" or "type denoted by such and such notation."
  37.  
  38. Agreed, agreed. I was tempted this way, it's quite clearer, but then I
  39. preferred 'type denotation' because it can be shortened to 'denotation',
  40. which is less overloaded than 'type', and also rhymes well with
  41. 'implementation' and 'specification' (I was also tempted to use
  42. 'notation' for 'interface' or 'protocol' or 'signature', but 'notation'
  43. is already too overloaded).
  44.  
  45. doug> (A running system as mutating specification?)
  46.  
  47. A good description: in the sense that each state of a system is
  48. characterized by a predicate, and a specification is the 'union', or
  49. generator, of all such predicates.
  50.  
  51. doug> I would extend this to say that at any one time an instance of a
  52. doug> class should also denote some type.  That is, with the proper
  53. doug> context instances and specification should both denote the same
  54. doug> abstract types.
  55.  
  56. I would be hugely surprised if this were not so! :-) Actually this is a
  57. good description of what goes on anyhow.
  58.  
  59. With one warning though: most languages and their implementations
  60. actually short circuit this by tagging, directly or indirectly, values
  61. (aka class instances) with a 'typing' code, that stands in lieu of the
  62. type denotation, which is hard to represent anyhow in the material world
  63. :-).
  64.  
  65. This is a bit like the rule in some languages (like Ada) that 'type a =
  66. real' and 'type b = real' are two different and incompatible 'types',
  67. even if so far* their denotation is the same, because 'a' and 'b' are
  68. different tags.
  69.  
  70.     *However usually one then defines different sets of additional
  71.     operations on 'a' and 'b', so their denotations diverge.
  72.  
  73. Other languages (like Algol 68) synthetize tags and assign one to all
  74. different 'types' that have the same canonical representation. This
  75. alternative is usually called 'name' vs.  'structure' based 'type'
  76. equivalence (and is a very hard choice; with Pascal it has changed every
  77. few years...).
  78.  
  79. I used to call this very common technique 'typing', short for 'typecode
  80. tagging' (but I agree with the objection I have been made that this is
  81. not the best erminology, but I am still trying to think of a better
  82. one), and the choice it forces between name and structural equivalence
  83. is a big nuisance, as if had to choose between 'eq' and 'equal' in Lisp
  84. systems, and blurs the distinction between a 'type' and its
  85. representation (which may well be another 'type', but the two are not
  86. then equivalent in any sense).
  87.  
  88. pcg> [ ... separation of interface/implementation/specification is good
  89. pcg> but not done in today's OO languages ... ]
  90.  
  91. doug> I think the goal is wonderful.  A few questions:
  92.  
  93. doug> O Do you have or know of any proposals for a system implementing
  94. doug> this principle?
  95.  
  96. I am thinking of a proposal, but currently my main research interests
  97. are elsewhere, so the thing has been down my TODO list for years now.
  98. On the other hand I know of several partial, but useful, realization of
  99. this not quite new idea:
  100.  
  101. * There used to be this library sw to catalogue of implementation
  102. components, called Calico, developed for the MDL OOL, done by people at
  103. the Programming Technologies Group of the MIT LCS. Calico was, and still
  104. is, probably the neatest and most effective example of a module
  105. repository, and one designed to support one of the neatest OO languages
  106. to date, MDL. It can also be argued that one of the main reason for the
  107. design of Multics shared libraries and dynamic linking was
  108. implementation reuse on a massive scale. Also, there is some work on
  109. programmer's assistants that is about recurring program idioms, etc.
  110.  
  111. * At the University of Wales (ask rjg@aber.ac.uk) there is this thing
  112. called CDL (Component Description) which is a language to describe
  113. interfaces and that offers notation for a full algebra on interfaces. It
  114. is similar to IDL (Interface Description), a bit nicer; the issue of
  115. interface description languages is fairly common in IPSE research, as it
  116. is quite important for building module repositories. Some languages
  117. offer some restricted form of interface reuse, for example Modula 3.
  118.  
  119. * Several people working on VDL and Z have had this idea of creating
  120. 'modular' specification, that is to have specifications that can be
  121. assembled more or less arbitrarily by mix/match of other specifications.
  122. Eiffel attaches snippets of specification to interfaces/implementations
  123. and subjects them to derivation. There used to be in the seventies some
  124. modular languages, like Alphard, which attempted to merge in some way
  125. specification into code (interface and implementation).
  126.  
  127. doug> O How would this new system handle the fact (?)  that
  128. doug> specifications are most often handled off-line on paper or in
  129. doug> someone's head?
  130.  
  131. By giving everybody a laptop with GNU Emacs, LaTeX and the relative VDL
  132. or Z editing/formatting modes :-).
  133.  
  134. More seriously: by being humble, making use only of specification
  135. snippets, a la Eiffel. The experience with Alphard and the like, which
  136. promoted heavvy merging of specification into code, has not been
  137. entirely positive, as one has then the double burden of maintaining both
  138. spec and code, and in synch. This might be useful in itself, but often
  139. it is mostly redundant (as the gap between a function and its intension
  140. often is not that great, an observation that 'logic' or 'functional'
  141. programming people have applied often improperly, and that 'constraint'
  142. programming technology is mostly about).
  143.  
  144. doug> How would it deal with specifications it can't really "understand"
  145. doug> well enough to transform to appropriate machine code. [ ... ]
  146.  
  147. Well, practically speaking, you punt. Ah right, you say, that's
  148. cheating. Indeed:
  149.  
  150. doug> And even if you do them right, today's compilers and systems
  151. doug> wouldn't be able use them.
  152.  
  153. But at least it helps having the facility there, even if it is neither
  154. completely implemented (the state of the art on theorem provers and
  155. program synthesis is not exactly brilliant) nor all powerful. Just a
  156. little bit of statement decoration with assertions helps a lot, just as
  157. it does help in many cases to decorate with 'typing' assertions (aka
  158. 'declarations') entity definitions.
  159.  
  160. doug> O An example?  How about seeing how the new system would address a
  161. doug> question that pops up on this group every month or two.  The
  162. doug> question is always how to organize the inheritance of a mutable
  163. doug> square class instance with three slots and a mutable rectangle
  164. doug> class instance with four slots.
  165.  
  166. doug> Now, how would this new system help clarify the notions of
  167. doug> abstract types (rectangle and square),
  168.  
  169. In no way at all! That's a problem for algebrists to solve. What is the
  170. optimal conceptual orthogonal base for an algebra that encompasses both?
  171. It's not a problem for the language designer. The task of the latter is
  172. to provide clean, general notation to _describe_ such things.
  173.  
  174. doug> class instances denoting specific types, and different constraints
  175. doug> on the mutation of instances?
  176.  
  177. Ah, ah. Here I think that really the problem is not 'reuse', which is
  178. (hopefullyl) maximized by the holy trimurti I mention so often, but is
  179. one of that 'typing' vs. 'type' problem I have mentioned above.
  180.  
  181. The question here really is that existing systems by and large do
  182. something really horrible, they assign over time the same typecode tag
  183. to values beloning to different type denotations. Suppose that I wrote a
  184. simple application to tell me the area code of a place, and this read a
  185. file containing a table whose entries were:
  186.  
  187.     struct areacode { unsigned code; char place[256]; };
  188.  
  189. and then I want to extend this application to internal phone calls; I
  190. could easily change the source to:
  191.  
  192.     struct areacode { unsigned country, code; char place[512]; };
  193.  
  194. but now the 'areacode' tag has a different type denotation! And the
  195. application will fail when reading the old file, of course. The problem
  196. exists, and is especially hard, in OO languages with some sort of
  197. workspace or persistency, e.g. Smalltalk. It is a huge problem
  198. everywhere, for example in data design and database implementation, and
  199. is called 'data reorganization'.
  200.  
  201. What independently reusable interface/implementation/specification can
  202. do is to make the cost of reorganization lower, by maximing reuse. For
  203. example with databases reorganizations are usually hidden thanks to
  204. 'view' definitions. Now these are really interface and implementation
  205. reuse, with fairly general algebras being possible.
  206.  
  207. Database people would find it incomprehensible to have views restricted
  208. to hierarchical derivation. *Both* joins and projections, (and
  209. dynamically computed fields), are really required in many views.
  210.  
  211. doug> O Could the system simultaneously and cleanly treat class
  212. doug> instances themselves (if there are such things as classes and
  213. doug> instances) as an interesting abstract type?
  214.  
  215. Well, here we are again strictly speaking outside reuse, and back to the
  216. little applied distinction between what I call 'typing' and 'type'.
  217. Class instances are, strictly speaking, just representations of the
  218. 'typing' information about a value. They are really internal data
  219. structures of the implementation (this point of view is taken for
  220. example in Self).
  221.  
  222. Since 'typing' is important for practical reasons (just as 'eq' is, and
  223. for the same reason for which computers don't have content addressable
  224. memories), maybe exposing 'typing' information helps, maybe in the same
  225. way that having the catalog part of the database helps (and is required
  226. by Codd for example for relational databases). In that case surely the
  227. ability to describe in my favourite way the representation of the meta
  228. information contained in 'class objects' does help.
  229.  
  230. doug> I think this second denotation (mentioned above) is needed to
  231. doug> solve many efficiency, meta-class, and OODB-type problems.
  232.  
  233. Not easy problems. The database people, who have been having a go at
  234. data dictionaries/catalogs for ages, still find it hard. Having a nice,
  235. flexible metamodel, and the ability to represent it with a model in the
  236. database itself, and they know how hard it is to do on the fly
  237. reorganization of both database and catalog structure with no semantics
  238. hazards.
  239.  
  240. However at least it helps to have a crisper terminology, cleaner
  241. insights, and more general and orthogonal notation that maximizes reuse.
  242. --
  243. Piercarlo Grandi                   | JNET: pcg@uk.ac.aber
  244. Dept of CS, University of Wales    | UUCP: ...!mcsun!ukc!aber-cs!pcg
  245. Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@aber.ac.uk
  246.