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