home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / misc / 3644 < prev    next >
Encoding:
Text File  |  1992-11-14  |  2.6 KB  |  53 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!caen!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
  3. From: jlg@cochiti.lanl.gov (J. Giles)
  4. Subject: Re: Pointers
  5. Message-ID: <1992Nov13.224022.16170@newshost.lanl.gov>
  6. Sender: news@newshost.lanl.gov
  7. Organization: Los Alamos National Laboratory
  8. References: <1992Nov5.014143.15635@newshost.lanl.gov> <id.6HVU.OC@ferranti.com> <1992Nov12.200950.8846@newshost.lanl.gov> <Bxnqv5.J71@mentor.cc.purdue.edu>
  9. Date: Fri, 13 Nov 1992 22:40:22 GMT
  10. Lines: 41
  11.  
  12. In article <Bxnqv5.J71@mentor.cc.purdue.edu>, hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  13. |> [...]
  14. |> Why do some people find it necessary to hide simple devices under 
  15. |> interfaces?  The insistence on the use of these interfaces is like
  16. |> the joke about the mathematician who pours the water out of the bucket
  17. |> and turns off the stove to reduce the problem to the previous case.
  18.  
  19. Why do some people want to hide simple devices under a mountain of
  20. confusing implementation detail?  It's like those ugly buildings
  21. from a few years back where all the girders, cables, and vent ducts
  22. were deliberately left exposed.  Bletch.
  23.  
  24. Yes, there are simple devices like `sets' whose operations are
  25. insert an element, delete an element, test for membership, union
  26. and intersection of pairs of sets, set difference, etc..  When 
  27. don't use an interface, then the code will be filled with linked
  28. lists, pointers, loops, etc. - or whatever implementation technique
  29. you chose to use.  This means that you can't see whether you've 
  30. *really* got sets at all!!  For all you know, some part of that
  31. mess of detail misuses the access protocol appropriate to sets 
  32. and is generating wrong, but plausible results.  Further, if you 
  33. decide to alter your implementation of sets to use bit strings
  34. or hash tables instead, you must change your *whole* code and
  35. not just the interfaces.  Bletch.
  36.  
  37. The same goes for all other structured data types.  Yes, you *can*
  38. implement arrays by doing all the address arithmetic yourself:
  39. explicitly.  No sane programmer would do so except as a last
  40. resort for optimization purposes.  Such optimizations would be
  41. carried out as careful transformations of the high-level construct,
  42. not rewrites at the low-level.  You write most of your array
  43. computations using the high-level interface in order to 1) have
  44. a better chance of writing correct code and 2) to allow the
  45. compiler to take advantage of known properties of arrays to 
  46. optimize better (like, no two parts of the same array are
  47. aliased to one another - something you *don't* necessarily
  48. know if you've messed around with raw address calculations
  49. yourself).
  50.  
  51. -- 
  52. J. Giles
  53.