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

  1. Newsgroups: comp.software-eng
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!asuvax!ncar!csn!raven!rcd
  3. From: rcd@raven.eklektix.com (Dick Dunn)
  4. Subject: Re: C CODE LAyout
  5. Message-ID: <1992Dec14.084405@eklektix.com>
  6. Organization: eklektix - Boulder, Colorado
  7. References: <1992Dec11.020200.944@seq.uncwil.edu> <MARTINC.92Dec11214534@hatteras.cs.unc.edu>
  8. Date: Mon, 14 Dec 1992 08:44:05 GMT
  9. Lines: 69
  10.  
  11. martinc@hatteras.cs.unc.edu (Charles R. Martin) writes:
  12. ...
  13. >If I read it aright, Herbst "likes a format that leaves the code free of
  14. >clutter" and therefore prefers to limit in-code comments to only those
  15. >few setting off the sections, plus some comments on the general meaning
  16. >of the code.
  17.  
  18. I read it somewhat differently.  I understood him to be objecting to
  19. comments-for-comments-sake.  I don't see any objection to comments
  20. describing difficult points, unusual constructs, etc.--although I'm led to
  21. a feeling that I have, that the way to fix obscure code is to remove the
  22. obscurity, and that therefore commenting around it is an admission of
  23. defeat.  Better to comment than to leave it obscure and unexplained, of
  24. course!
  25.  
  26. >I frankly have always found it very difficult to believe that anyone who
  27. >suggests such a style has any professional software engineering
  28. >experience...
  29.  
  30. Let me try to help you believe it.
  31.  
  32. I think the first matter is to narrow in on what the real difference is
  33. between your perspective and Herbst's.  You've obviously been burnt by code
  34. with inadequate commenting, Herbst by overcommented code.
  35.  
  36. If it would help, I could run some statistics on code I'm working on right
  37. now--it's written in a style that our group finds fairly comfortable, and
  38. we've been able to move pretty quickly with it.  I could characterize
  39. things like comment size distribution, density, etc.  (Hate to suggest
  40. getting so close to reality in comp.software-eng, but what the hell...)
  41.  
  42. >...My experience has *always* been that, on examination, the
  43. >people who discourage detailed comments in code have spent their entire
  44. >professional career in academic settings, writing code in a small group,
  45. >with relatively little maintenance of code by anyone other than the
  46. >author, and in general with products of only a few thousand lines of
  47. >code.
  48.  
  49. I've had quite a different experience.
  50.  
  51. I've run across a variety of commenting styles/levels: minimalist, flowery/
  52. ornate (rococode:-), rigid/formal/structured, logorrheic (?sp?).  I find
  53. code from academia more often leading to endless tedious descriptions of
  54. what's going on--I don't know whether it comes from faculty who have grown
  55. accustomed to explaining the painfully obvious to students who don't want
  56. to learn, semester after semester, or from being in a setting with a lot of
  57. leisure to write on and on.  You'll also get a lot of commentary from the
  58. folks being paid by the line (either implicitly or explicitly) - because
  59. hey, comments don't have to work!  Easy productivity!  Defense-contract
  60. code...urk, much bad magic, abandon all hope...  But if you look to
  61. successful commercial programming, and look where the problems are new and
  62. difficult (not just endless repetition of the last AR/AP code, or the last
  63. controller interface), you find comments focusing in on what's really
  64. needed, eschewing anything not obviously useful.  This last one is where I
  65. live, and I really see it a lot.
  66.  
  67. >In the more common engineering environment, in which code must be
  68. >expected to have a lifespan of several generations of programmers,
  69. >*much* more detailed code commenting is not just desirable, it is
  70. >essential. 
  71.  
  72. If the code I have to work with, day to day, were strewn with detailed
  73. comments, I'd go nuts.  I also wouldn't be anywhere near as effective,
  74. because I have to deal mostly with code I didn't write...I don't have
  75. *time* to wade through detailed comments except in the few cases that
  76. they really say something important.  Concise is nice.
  77. -- 
  78. Dick Dunn    rcd@raven.eklektix.com   -or-   raven!rcd    Boulder, Colorado
  79.     ...Straight, but not narrow.
  80.