home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / object / 3507 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  11.7 KB

  1. Path: sparky!uunet!mcsun!uknet!gdt!aber!aberfa!pcg
  2. From: pcg@aber.ac.uk (Piercarlo Grandi)
  3. Newsgroups: comp.object,comp.database.theory
  4. Subject: Re: Object-Oriented Methodologies - Class Specifications
  5. Message-ID: <PCG.92Sep10165302@aberdb.aber.ac.uk>
  6. Date: 10 Sep 92 16:53:02 GMT
  7. References: <1992Sep8.192520.2575@projtech.com>
  8. Sender: news@aber.ac.uk (USENET news service)
  9. Reply-To: pcg@aber.ac.uk (Piercarlo Grandi)
  10. Organization: Prifysgol Cymru, Aberystwyth
  11. Lines: 234
  12. In-Reply-To: sally@projtech.com's message of 8 Sep 92 19: 25:20 GMT
  13. Nntp-Posting-Host: aberdb
  14.  
  15.  
  16. NOTE: this is crossposted to comp.database.theory, and the part really
  17. relevant to it is at the end, and is about Wierderhold's quite
  18. extraordinary conjecture that all relations fall into one of seven
  19. quite precise categories.
  20.  
  21. On 8 Sep 92 19:25:20 GMT, sally@projtech.com (Sally Shlaer) said:
  22.  
  23. sally> graham@maths.su.oz.au (Graham Matthews) writes:
  24.  
  25. graham> Get into a domain like mathematics where every object is related
  26. graham> to every other object in many many ways, and OO begins to show
  27. graham> its failures.
  28.  
  29. As Sally Shlaer remarks later, this is by no means confined to
  30. mathematics, as any database theory person can attest. Even seemingly
  31. simple cases involve complicated structures. But yes, maths is a good
  32. example, and we are all more or less familiar with it.
  33.  
  34. sally> In <1992Sep6.003055.2236@tfs.com> eric@tfs.com (Eric Smith) writes:
  35.  
  36. eric> If you insist on modelling all possible relationships at once,
  37. eric> then yes, it does get complicated.  But trying to model them
  38. eric> without OO would be far more complicated.
  39.  
  40. sally> Graham writes:
  41.  
  42. graham> There are many many more relationships that I cannot model with
  43. graham> inheritance, so I am suggesting that people need to look very
  44. graham> carefully at inheritance.
  45. sally>               ~~~~~~~~~~~
  46.  
  47. Well, what Graham Matthews is saying here seems to be that if OO is a
  48. step forward in one way (you can describe more clearly *some* types of
  49. relationships), it is also a step backwards (some, or maybe many, other
  50. types of relationships become more awkward to describe).
  51.  
  52. I tend to agree with this point of view :-); I believe that if one looks
  53. as OO as a decomposition strategy based on relatedness by representation
  54. (full definition available on request) then it is obvious that the
  55. strategy is not universally applicable, no matter how flexible the
  56. supporting notation, because there are many cases where quite clearly a
  57. procedure is equally related to two different representations, or even
  58. two different values.
  59.  
  60.   Two examples to make this clear, at both the 'type' and 'value' level
  61.   of abstraction: should FloatToInt belong to the Float or Int classes?
  62.   it needs access to both representations _equally_; should '1+3' be seen
  63.   as the '+3' message being sent to 1, the '1+' message being sent to
  64.   '3', the 'cons(1,3)' message being set... and so on.
  65.  
  66.   Also, my mantra 'independent algebras for specification implementation
  67.   notation' clearly implies a more general decomposition paradigm than
  68.   the OO one, and actually does not imply any specific decomposition
  69.   paradigm at all. But I also reckon that I know a more general yet still
  70.   quite specific decomposition paradigm than the OO one, and it is quite
  71.   unconventional and surprising (anybody taking the bait? :->).
  72.  
  73. sally> I would suggest instead that we need to look carefully at
  74. sally> *additional techniques* for modeling relationships.
  75.  
  76. Applause, applause! The data structures within programs are as rule as
  77. complex and sophisticated as those within a databse, and program design
  78. requires *excatly* the same conceptual tools aand attention to data
  79. design as setting up a database. Suggestion seconded!
  80.  
  81. sally> In my experience, entities in the world are related in very
  82. sally> interesting and complex ways -- and to capture these
  83. sally> relationships accurately requires a much richer topology than can
  84. sally> be attained with hierarchies alone.
  85.  
  86. Further applause! The database people have known this for ages, it's time
  87. 'programmers' got into the act themselves.
  88.  
  89. But, as we both note below, much of the confusion in this thread (and in
  90. the articles with whom I have been discussing previosuly) stems from not
  91. separating levels of abstraction.
  92.  
  93. One thing is the structure of relationships between values and another
  94. the structure of the relationships between the properties ('types') of
  95. such values. Another difference is between modeling and implementing, as
  96. you note:
  97.  
  98. sally> Note that virtually all of the OO *analysis* methods allow you to
  99. sally> model such relationship structures.
  100.  
  101. In a network or entity-relationship sort of model. In practice most
  102. current OO technology involves a fully general directed navigation
  103. network for relationships between values, a fairly awkward hierarchy
  104. with possibly shared branches for relationships between 'types', and
  105. forests of trees for analysis of data designs.
  106.  
  107. Database people nowadays make these distinctions all the time; it is
  108. possible to do relational data analysis and then map it onto a network
  109. catalog, and this may well describe a hierarchical data structure.
  110.  
  111. And thus:
  112.  
  113. graham> There are many many more relationships that I cannot model with
  114. sally>                                                       ~~~~~
  115. graham> inheritance, so I am suggesting that people need to look very
  116. graham> carefully at inheritance.
  117.  
  118. sally> But perhaps you meant "implement" rather than "model".  This
  119. sally> suggests to me that we should investigate the pros and cons of
  120. sally> *different* techniques for implementing relationships in various
  121. sally> situations.
  122.  
  123. I would rather say that we need techniques to both model and implement
  124. relationships.
  125.  
  126.  
  127. Incidentally maybe we don't need a different technique at every
  128. abstraction level (value, type, model) or across dimensions (semantics,
  129. implementation, syntax), but surely it can be done. For example in the
  130. database world as a rule one can relational thruout: relational
  131. analysis, relational catalog, relational values.
  132.  
  133. This naturally for description/modeling; for representation/implementing
  134. one can usually choose between multiple more or less semantically
  135. equivalent but pragmatically different implementations:
  136.  
  137. sally> Several ways spring to mind:
  138. sally> 1.  Inheritance
  139. sally> 2.  Use a pointer to point to the related object
  140. sally> 3.  Use an instance variable to contain an identifier
  141. sally>     of the related object
  142. sally> 4.  Define a class to implement the relationship, and use
  143. sally>     either a pointer or an instance variable with an
  144. sally>       identifier to link the related objects.
  145.  
  146. Ah, but to list them in this braindump order runs a risk to help the
  147. confusion prone among us (surely not you, as you later on clearly
  148. demonstrate) to make a big confusion between completely different
  149. dimensions/abstraction levels!  Inheritance is an awkward way to
  150. describe/model relationships between properties of values, pointers are
  151. for representing/implementing relationships between values.
  152.  
  153. I don't forget that if 'types' are represented themselves as values,
  154. then the relationships between 'types' have to be represented as
  155. relationships between values, but the distinction is strong and remains,
  156. so one should not have as casual an attitude as that displayed by:
  157.  
  158. sally> (per the suggestion from eric@tfs.com (Eric Smith):
  159.  
  160. eric> The trick is to see that relationships are themselves objects.
  161. eric> For example, the ways a line and a circle can relate to each other
  162. eric> are the line-circle relationship, which is a subclass of the
  163. eric> two-geometric -figure relationship.
  164.  
  165. Well, what you are really suggesting here is to operate a confusion
  166. between an entity and its representation as a value, and the
  167. relationships thereof. I find it dangerous!
  168.  
  169. When database people query a relational catalog they know damn well that
  170. the values they get back are of a fundamentally different nature from
  171. the values they get from querying the non catalog relations. There is a
  172. lot of difference between values that refer to table and domains and
  173. data that refers to tuples and values.
  174.  
  175. In many traditional OO languages it is compilers (C++) or runtime
  176. systems (Smalltalk) that contain the meta database that represents the
  177. relationships between 'types' represented as values (e.g. as symbol
  178. table entries or instances of class Class).
  179.  
  180. This tends to make confusion easier rather than more difficult, because
  181. while data and metadata are of a different nature, they can well be
  182. described in the same way, even in a reflective way, as for example with
  183. relational DBMSes that store the catalog as a set of relations in the
  184. database itself.
  185.  
  186. sally> 5.  Eric's other suggestion:
  187.  
  188. eric> For example, a specific relationship is a subclass of
  189. eric> relationship, because it "is a" relationship.  Q.E.D.  The same
  190. eric> logic carries from specific relationships to more specific
  191. eric> relationships.  e.g., the relationship between two animals is a
  192. eric> base class of the relationship between a bear and a bobcat,
  193. eric> because the bear-bobcat relationship "is a" two-animal
  194. eric> relationship.  And the relationship between a bear and a salmon is
  195. eric> a subclass of the mammal-fish relationship, because it "is a"
  196. eric> mammal-fish relationship.  And the mammal-fish relationship itself
  197. eric> is a subclass of the two-animal relationship.  So you start to see
  198. eric> a tiny part of a vast inheritance structure of relationships.
  199.  
  200. sally> Note that this last idea has a fundamentally different nature, in
  201. sally> that it constructs a class in a different domain (subject matter)
  202. sally> -- the domain of OO (or relational theory, or whatever) and not
  203. sally> the domain of the application (Dog Care and Feeding).
  204.  
  205. Ah precisely. Further applause!
  206.  
  207. sally> Is it possible to state guidelines to help a designer decide what
  208. sally> is the best way to implement each of the relationships in the Dog
  209. sally> example above?  I would like to see a discussion on this matter.
  210.  
  211. Well, the databaase people have something to say about this. They have
  212. not settled all the details (for example I and several others think that
  213. Codd has said something terribly wrong about null values), but a lot of
  214. interesting and helpful technology exists.
  215.  
  216. My favourite source is Wiederhold "Database design". The first part is
  217. about implementation, and the second is about data design, and is
  218. beautifully done and written. The second part applied virtually
  219. identically to data design in programs, not just in databases, as it is
  220. essentially an issue about our cognitive processes (I was very bemused
  221. to see somebody trying to pontificate on how cognitive processes work
  222. *in general*: "everything is an object", sure), and the database people
  223. have worked a lot on the fundamental issues of knowledge representation.
  224.  
  225. Widerhold makes an extraordinary contention in the second part of his
  226. book, one that as far as I know has gone largely unnoticed:
  227.  
  228.   all relations/relationships can be modeled with just seven different
  229.   categories of tables.
  230.  
  231. He gives absolutely no supporting arguments for this, he just states so,
  232. offering some examples, making it merely a conjecture, but I tend to
  233. believe it.
  234.  
  235. If one accepts his conjecture, then all one has to do for data design is
  236. to do relational analysis, tag each relation with one of those seven
  237. categories, and then map each of the seven types onto the primitives of
  238. the underlying implementation medium, be it a DBMS of any sort, or a
  239. programming language. This can be done both for data (values) and
  240. metadata (types), along any abstraction level and along any dimension.
  241.  
  242. Incidentally, that's how I tend to attack data design issues in my
  243. programs (yes, I often do *informal* relational schemas and then I map
  244. them onto records and pointers and hash tables and trees and whatever).
  245. --
  246. Piercarlo Grandi                   | JNET: pcg@uk.ac.aber
  247. Dept of CS, University of Wales    | UUCP: ...!aber-cs!pcg
  248. Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@aber.ac.uk
  249.