home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 20098 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  3.6 KB

  1. Xref: sparky comp.lang.c++:20098 comp.object:5118
  2. Newsgroups: comp.lang.c++,comp.object
  3. Path: sparky!uunet!mole-end!mat
  4. From: mat@mole-end.matawan.nj.us
  5. Subject: Re: Pros and cons of C++
  6. Message-ID: <1993Jan26.184208.22946@mole-end.matawan.nj.us>
  7. Summary: When to recompile ...
  8. Organization: :
  9. References: <MUTS.93Jan13090705@PMCS.estec.esa.nl> <C1G9H4.HsA@unix.portal.com>
  10. Date: Tue, 26 Jan 1993 18:42:08 GMT
  11. Lines: 64
  12.  
  13. In article <C1G9H4.HsA@unix.portal.com>, samantha@shell.portal.com (Samantha Atkins) writes:
  14.  
  15. > Hmmmm.  It seems to me that a couple of problems exist with all the static
  16. > type languages (compile time checking) that I am familiar with.
  17.  
  18. > The first problem is that such languages require recompilation of any and
  19. > all affected code whenever the type hierarchy is reworked even if this 
  20. > results in no changes at all to the behavior of any objects in the application.
  21.  
  22. Depends what you mean by `affected code.'  If I have code which takes a
  23. parameter of type  X  and I derive  X1  and  X2  from  X , I can use that
  24. code on  X1  and  X2  without recompiling it.  On the other hand, if I
  25. change the definition of  X , then I do have to recompile.
  26.  
  27. > In practice for larger projects this is an unholy terror.  I may be wrong
  28. > but I thought that one of the blessings of OO was being able to refine a
  29. > design even with working code in the field with little or no impact.  
  30.  
  31. Impact to _what_?
  32.  
  33. > The second problem is related in that most such languages use type based
  34. > checking.  It seems to me that what we are really concerned with is:
  35. >     a) does this object understand the message we are sending?
  36. >     b) does its behavior conform to what we intended in response?
  37. > No object language I am aware of does a message based much less a decent
  38. > semantic based check.  So in what way has safety been assured really?
  39. > Only in that the type understands the message.  OK.  So if I want to get
  40. > the maximum flexibility I would probably tend to factor my class hierarchy
  41. > very highly with lots and lots of mix-in classes for every reasonable 
  42. > set of behaviors.  ...
  43.  
  44. You pay a price for every bit of flexibility you have.  If I have an
  45.  int  instead of a  const int  in code, I am just a bit less certain that
  46. that object's value is what it was a statement ago.  The key is determining
  47. the kinds of flexibility that you need and the kinds you don't, and paying
  48. only for what you need.  OO is not a silver bullet, just another stall in
  49. the marketplace.
  50.  
  51. > ...
  52. > Am I going askew here or is it as it seems to me that so called strong typing
  53. > creates an untenable mess if you seriously attempt its use now and for the
  54. > future?
  55.  
  56. If you don't know what you want, then strong typing isn't for you.
  57.  
  58. But if you can make reasonable engineering judgements about the places
  59. where you will need flexibility and the places where you can do with
  60. less flexibility, you can shape your design for maximum re-use of the
  61. design.  Re-use of code will follow.
  62.  
  63. In a way this is like the discussion of non-virtual functions in base
  64. classes: they make all the sense in the world if you can define for
  65. your type things which will be invariant across its entire derived class
  66. hierarchy.  If you need complete flexibility, of course, you use an
  67. abstract base with all pure virtual functions.  In practice, you _want_
  68. to limit flexibility to just those places that need it to reduce the
  69. cost in uncertainty paid by the fellow reading and re-using the code.
  70.  
  71. These are engineering decisions, not matters of doctrine and heresy.
  72. -- 
  73.  (This man's opinions are his own.)
  74.  From mole-end                Mark Terribile
  75.  
  76.  mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
  77.