home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / ada / 2566 < prev    next >
Encoding:
Text File  |  1992-09-09  |  4.3 KB  |  85 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!spool.mu.edu!darwin.sura.net!Sirius.dfn.de!Urmel.Informatik.RWTH-Aachen.DE!grieg!pk
  3. From: pk@rwthi3.informatik.rwth-aachen.de (Peter Klein)
  4. Subject: Re: MI - clutching at straws
  5. Message-ID: <1992Sep9.142434.3940@Urmel.Informatik.RWTH-Aachen.DE>
  6. Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
  7. Nntp-Posting-Host: grieg
  8. Reply-To: pk@rwthi3.informatik.rwth-aachen.de
  9. Organization: Lehrstuhl fuer Informatik III, RWTH Aachen, Germany
  10. References: <EACHUS.92Sep8135021@Dr_No.mitre.org>
  11. Date: Wed, 9 Sep 92 14:24:34 GMT
  12. Lines: 71
  13.  
  14. In article 92Sep8135021@Dr_No.mitre.org, eachus@Dr_No.mitre.org (Robert I. Eachus) writes:
  15. >   A design which contains objects which are simultaneously in lists
  16. >and trees is not inherently a bad design.  But if you need to do it,
  17. >the programmer needs either to develop a set of higher level
  18. >abstractions or pay attention to details when an object is say removed
  19. >from a list.  (If the object is also an interior node in the tree, do
  20. >you have to delete it from the tree first, or just remember its
  21. >children and reinsert them? Is it legal to have objects that are in a
  22. >list but not in a tree, or vice-versa? And so on.)  It can be done,
  23. >BUT if list and tree primitives are separately inherited the
  24. >programmer has to do most of the work.  A much better approach would
  25. >be to use single inheritance from a tree type, and extend it with list
  26. >primitives which are sensitive to the tree structure.  The progammer
  27. >must still answer the same questions, but only in one place--the
  28. >definition of the list type.
  29. >
  30. >     So what I was really trying to say was that in this example it is
  31. >dificult to compare relative advantages and disadvantages of different
  32. >MI approaches, since any SI approach is so much cleaner.
  33.  
  34. Well, I agree with you in the list/tree example. But, if you remember
  35. my first post, I already excluded such cases where MI is used to combine
  36. independent classes. This is not only dangerous, it is also a design
  37. which can be easily implemented without MI (and without inheritance
  38. at all).
  39.  
  40. Unfortunately, your arguments don't hold in my example, where several
  41. extensions of the same base type are combined. The resulting type is
  42. essentially the base type augmented by an arbitrary subset of the possible
  43. extensions. The problems you mentioned cannot arise in this context.
  44. Furthermore, it is pretty awkward to simulate such behaviour without MI.
  45.  
  46. In your previous post, you wrote:
  47.  
  48. >In article <1992Aug31.153641.29954@Urmel.Informatik.RWTH-Aachen.DE> >pk@rwthi3.informatik.rwth-aachen.de (Peter Klein) writes:
  49. >
  50. >   In a more general sense, it cannot be reasonable to extend a basic type
  51. >   by inheritance or by genericity depending on the fact whether you want
  52. >   to combine some extensions later on. If you think that the extensions
  53. >   should be done by inheritance, you'll end up missing MI if you want to
  54. >   combine extensions on a higher level. On the other hand, if you say that
  55. >   the extensions should be done using genericity, you won't need MI. But
  56. >   in this case, you don't need inheritance at all.
  57. >
  58. >   Close.  IMHO inheritance is one of the least important OO features
  59. >being added to Ada 9X, but as I mentioned above it does have its uses.
  60. >In Ada 9X as in Ada 83, generics will be a much more powerful tool,
  61. >and should be the tool of choice in many areas where inheritance is
  62. >naturally used in other OO languages.
  63.  
  64. Not true. Inheritance is the more powerful feature. Dynamical binding cannot
  65. be done with genericity; you'll never get true polymorphism without
  66. inheritance. But I don't think this is the question. Genericity and
  67. inheritance both have their uses, and most of the time the design makes
  68. clear which of them is appropriate in a given situation. If you think that
  69. inheritance is not *really* needed, I can accept that. But my original
  70. question was: What do I loose when I have SI only? In what way does the
  71. lack of MI affect the usefulness of the whole inheritance idea? *If* I
  72. think extensions of a base type should be done using inheritance, how do
  73. I solve the problem of combining independent extensions afterwards?
  74.  
  75. Peter
  76.  
  77. ---
  78. Peter Klein                        E-Mail: pk@rwthi3.informatik.rwth-aachen.de
  79. Lehrstuhl fuer Informatik III      Tel.: +49/241/80-21320
  80. Ahornstrasse 55                    Fax.: +49/241/80-21329
  81. RWTH Aachen
  82. D-5100 Aachen
  83. Germany
  84.  
  85.