home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19803 < prev    next >
Encoding:
Text File  |  1993-01-23  |  4.0 KB  |  71 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!cs.utexas.edu!uwm.edu!linac!att!att!dptg!ulysses!allegra!princeton!csservices!princeton.edu!elan!mg
  3. From: mg@elan (Michael Golan)
  4. Subject: Re: MI vs. SI
  5. Message-ID: <mg.727630597@elan.princeton.edu>
  6. Sender: news@csservices.Princeton.EDU (USENET News System)
  7. Organization: Princeton University, Dept. of Computer Science
  8. References: <1993Jan20.022321.18020@borland.com> <1993Jan21.093918.3738@fmrco.uucp>
  9. Date: 21 Jan 93 15:36:37 GMT
  10. Lines: 59
  11.  
  12. pandrews@lovat.fmrco.com (Paul Andrews) writes:
  13. >Totally agree. Why oh why oh why (:-)) do folks have such a downer on MI? 
  14.  
  15. Because
  16. 1) Most implementations are buggy. Maybe all those compiler writers are
  17.    idiots. Maybe the idea too complex and not well understood/documented.
  18. 2) MI is hard to implement, hard to understand, hard to use correctly
  19. 3) MI can add bugs that are hard to detect
  20. 4) MI lead to bad design, where people make one class into 3 (inhereting
  21.    from two smaller classes), just so that (1) and (2) could possibly be used
  22.    independently, even when this is not likely or important
  23. 5) MI is commonly used as a hack to combine incompatible classes that 
  24.    are badly designed to begin with. This might be nice and good in the 
  25.    short-run, for older C++ classes designs. It is most likely bad in the 
  26.    long run.
  27. 6) They were mostly needed before the templates-era, when classes where used
  28.    in implementing template-concepts, e.g. when a class had to be derived
  29.    from LIST to be on the list. Then, when you wanted to collect some
  30.    functionality on a list, you had to use MI. You still have to do so,
  31.    if your "LIST" is some complex class, that *combines* a collection-
  32.    mechanism with other functionality. Most such designs are bad, and 
  33.    using MI instead of fixing the design is a bad idea.
  34. 7) The complications to the language far out-weight the benefits, and it
  35.    seems to have no end in sight. See dynamic_cast<Ouch>(Arr)
  36. 8) People abuse SI. I have seen many abstract classes with a field "type",
  37.    which is set by each derived class and is checked at both levels.
  38.    I consider this "cheating". The escape from such bad design is with MI,
  39.    and I don't like it. Sure, you can tell me not to use/buy/touch such 
  40.    code, but in the real world we have to compromise. Call us "Nazis", for
  41.    we would like to force you into "good design" by limiting your options.
  42.    This might hurt the super-smart designer, but improve the average programmer
  43.    productivity. And yes, we are concerned with the later. The former can
  44.    find a smart way to overcome the limits anyway, when required.
  45.     
  46. You claim that the NIH lib would be better off with MI, and that this is
  47. "clear". I challenge you to a battle of wits (The princess's bride:-).
  48. Show us an example! Many people in this group have been claiming for some time
  49. now, that they are yet to have seen code where MI is needed when the 
  50. classes are correctly designed (w/templates) from scratch. 
  51. The last example on the net was a bank account class, from which credit and
  52. debit accounts were derived, and then MI was used to combine their functions.
  53. This is a typical bad example. How are the accounts stored on the disk?
  54. wouldn't the code as a whole be shorter and easier to understand if
  55. these where combined into one class? Only when real code is presented, to
  56. achieve a real task, can we truely compare such approaches.
  57.  
  58. No doubt someone will tear this posting apart. Each point will be attacked
  59. independently. I am sure I will be flamed for my own stupidity for not 
  60. understanding the simple concepts behind MI, which are so obvious. You will
  61. also tell us that soon, soon, MI will be implemented perfectly, and that you
  62. have already used it in 100k lines project and it was indispensable.
  63. Never the less, many people will remain steadfast in their believes in
  64. many of the above claims. We don't believe this complexity is necessary,
  65. and we would like a shorter reference manual!
  66.  
  67. Of course, we lost the battle a long time ago. Lets design ++C.
  68.  
  69.  Michael Golan
  70.  mg@cs.princeton.edu
  71.