home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!concert!borg!news_server!martinc
- From: martinc@hatteras.cs.unc.edu (Charles R. Martin)
- Newsgroups: comp.software-eng
- Subject: Re: C CODE LAyout
- Message-ID: <MARTINC.92Dec11214534@hatteras.cs.unc.edu>
- Date: 12 Dec 92 02:45:34 GMT
- References: <1992Dec11.020200.944@seq.uncwil.edu>
- Sender: news@cs.unc.edu
- Organization: UNC Department of Computer Science
- Lines: 49
- In-reply-to: herbst@seq.uncwil.edu's message of 11 Dec 92 02:02:00 GMT
-
- In article <1992Dec11.020200.944@seq.uncwil.edu> herbst@seq.uncwil.edu (R.T. Herbst) writes:
-
- On the subject of C CODE layout.
- ....
- /*Declare external variables, functions, defines, and includes.
- Use comments as necessary to describe variables.
- */
- main()
- {
- /*Declare internal variables*/
-
- /* Execute*/
- }
-
- I like a format that leaves the code free from clutter.
- The code in K&R has about the rigth level of commenting.
- A good makefile will provide the relationship of main
- program and related files.
-
- I don't know that I mean to start a style flame war, but (as one of
- those people who had painfully to learn to write code with an
- unprofessional lack of comments in order to keep from losing points for
- "too many" comments in academic programming classes) I couldn't bear to
- let this go unchallenged.
-
- If I read it aright, Herbst "likes a format that leaves the code free of
- clutter" and therefore prefers to limit in-code comments to only those
- few setting off the sections, plus some comments on the general meaning
- of the code.
-
- I frankly have always found it very difficult to believe that anyone who
- suggests such a style has any professional software engineering
- experience. My experience has *always* been that, on examination, the
- people who discourage detailed comments in code have spent their entire
- professional career in academic settings, writing code in a small group,
- with relatively little maintenance of code by anyone other than the
- author, and in general with products of only a few thousand lines of
- code.
-
- In the more common engineering environment, in which code must be
- expected to have a lifespan of several generations of programmers,
- *much* more detailed code commenting is not just desirable, it is
- essential.
- --
- Charles R. Martin/(Charlie)/martinc@cs.unc.edu
- Dept. of Computer Science/CB #3175 UNC-CH/Chapel Hill, NC 27599-3175
- 3611 University Dr #13M/Durham, NC 27707/(919) 419 1754
- "Oh God, please help me be civil in tongue, pure in thought, and able
- to resist the temptation to laugh uncontrollably. Amen." -- Rob T
-