home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!darwin.sura.net!uvaarpa!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.92Dec14120615@hatteras.cs.unc.edu>
- Date: 14 Dec 92 17:06:15 GMT
- References: <1992Dec11.020200.944@seq.uncwil.edu>
- <MARTINC.92Dec11214534@hatteras.cs.unc.edu>
- <1992Dec14.084405@eklektix.com>
- Sender: news@cs.unc.edu
- Organization: UNC Department of Computer Science
- Lines: 53
- In-reply-to: rcd@raven.eklektix.com's message of 14 Dec 92 08:44:05 GMT
-
- In article <1992Dec14.084405@eklektix.com> rcd@raven.eklektix.com (Dick Dunn) writes:
-
- martinc@hatteras.cs.unc.edu (Charles R. Martin) writes:
- ...
- >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 read it somewhat differently. I understood him to be objecting to
- comments-for-comments-sake.
-
- That's precisely the reason I phrased it "if I read it aright" of
- course.
-
- I don't see any objection to comments
- describing difficult points, unusual constructs, etc.--although I'm led to
- a feeling that I have, that the way to fix obscure code is to remove the
- obscurity, and that therefore commenting around it is an admission of
- defeat. Better to comment than to leave it obscure and unexplained, of
- course!
-
- In the device driver I've been writing in my day job, I've just gone
- through an exercise of taking my nice clear code and re-writing it
- obscure in some essential areas as a performance optimization. We're
- down to that last little bum an instruction here and there phase in an
- otherwise working driver. I would normally agree with you about recode
- it clearer, but sometimes you cannot.
-
- >I frankly have always found it very difficult to believe that anyone who
- >suggests such a style has any professional software engineering
- >experience...
-
- Let me try to help you believe it.
-
- I think the first matter is to narrow in on what the real difference is
- between your perspective and Herbst's. You've obviously been burnt by code
- with inadequate commenting, Herbst by overcommented code.
-
- Rather than continue the point-by-point, let me propose a different
- model of the difference: I think the difference is that Herbst's model
- is that the difficulty of understanding is a *result* of "too many"
- comments ("hiding the code"); mine is that difficulty of understanding
- is a result of insufficiently informative comments. As I said in
- passing in an earlier post, I think one of the troubles here is that the
- number of comment lines isn't necessarily coupled with how informative
- they are.
- --
- 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
-