home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / software / 4953 < prev    next >
Encoding:
Text File  |  1992-12-14  |  3.0 KB  |  58 lines

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsm!lfd
  3. From: lfd@cbnewsm.cb.att.com (Lee Derbenwick)
  4. Subject: Re: C code Layout
  5. Organization: AT&T
  6. Date: Mon, 14 Dec 1992 23:55:21 GMT
  7. Message-ID: <1992Dec14.235521.1557@cbnewsm.cb.att.com>
  8. Summary: BSD utilities != UNIX source code, plus large-comment maintenance.
  9. References: <1992Dec14.074411@eklektix.com> <1992Dec14.175533.8400@fcom.cc.utah.edu>
  10. Lines: 46
  11.  
  12. In article <1992Dec14.175533.8400@fcom.cc.utah.edu>, bryant@ced.utah.edu (Bryant Eastham,MEB 3116,581-5353) writes:
  13. > In article 074411@eklektix.com, rcd@raven.eklektix.com (Dick Dunn) writes:
  14. > >Next, step back and look at where UNIX has gone.  That code has been read
  15. > >and understood by tens of thousands of people, and has been successfully
  16. > >modified over and over again for many years, often by people with almost no
  17. > >training or aptitude.  Like it or not, there is massive evidence that the
  18. > >style DOES work, IS understandable, and IS maintainable.  It's *not* the
  19. > >only workable style!  But it works.
  20. > I suppose that explains why the examples of poor (very poor) commenting
  21. > style for my senior lab class were from the source for UNIX! No lie,
  22. > one assignment was to comment the command "strings", which (from the
  23. > distribution) had (if I remember right) ONE COMMENT LINE. I don't know
  24. > who that style works for. Certainly not anyone in the class or the
  25. > instructors.
  26.  
  27. This is a poor counterexample, because the "strings" command was
  28. added by someone at UC Berkeley; it's unfair to count it as part of
  29. the UNIX source code cited by Dick Dunn.  Certainly not in a thread
  30. that had mentioned Kernighan and Ritchie.  From your description of
  31. the source code, it doesn't sound as if strings.c was commented in
  32. anything resembling "K&R style".
  33.  
  34. One reason that I personally dislike very large comments embedded in
  35. the code is that they greatly reduce the amount of code within my
  36. visual field (whether on a screen or on paper): they increase the
  37. number of fingers I need to read the code.  [An interesting
  38. "difficulty" metric that I've seen attributed to Tom DeMarco.]
  39.  
  40. Another reason, potentially more damaging in the long run, is that
  41. long comments don't seem to be maintained as well as short ones.
  42. Somebody changed the code, but didn't go back to update the fourth
  43. line of the fifteen-line comment back at the beginning of the loop.
  44. So the comment now lies about what the code is doing.  That seems
  45. to happen far less often with concise comments attached to the code
  46. they describe.
  47.  
  48. This second problem may also occur with literate programming
  49. systems. They are still too new to have had large, production code
  50. maintained for several years in them.  It will be interesting to
  51. see if they avoid the problem of the text being less-maintained
  52. than the executable code itself.
  53.  
  54.  -- Speaking strictly for myself,
  55.  --   Lee Derbenwick, AT&T Bell Laboratories, Holmdel, NJ
  56.  --   lfd@cbnewsm.ATT.COM  or  <wherever>!att!cbnewsm!lfd
  57.