home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.software-eng
- Path: sparky!uunet!mole-end!mat
- From: mat@mole-end.matawan.nj.us
- Subject: Re: C code Layout
- Message-ID: <1992Dec16.152026.28190@mole-end.matawan.nj.us>
- Summary: Final causes ...
- Organization: :
- References: <1992Dec14.074411@eklektix.com> <1992Dec14.175533.8400@fcom.cc.utah.edu>
- Date: Wed, 16 Dec 1992 15:20:26 GMT
- Lines: 57
-
- > >back to Bryant, who talks about the difference between useless comments,
- > >like:
- > >> i = i + 1; /* Increment i */
- > >(no argument here, of course)
-
- > >....and useful, necessary explanations like:
-
- > >> /*
- > >> * We are now done with the code for widget i, and while
- > >> * the "for" loop will increment i again, we want to skip
- > >> * the next widget and so we increment i here as well.
- > >> */
-
- > >> i = i + 1;
-
- > >The *idea* of commenting this situation is good. You don't want somebody
- > >looking at it, wondering whether the increment is supposed to be there or
- > >was left over from a different sequence, etc...it's a good situation for
- > >stopping to describe what's going on. It's the realization that is bad.
- > >(To a C programmer, the first problem is that the code should be
- > > i++;
-
- Pardon me for flaming, but ...
-
- You are all of you looking in the wrong direction.
-
- Any programmer can tell that i++ or i += 1 or i = 1 + 1 will increment
- the value. And, with a little context, it should be clear that it means
- that the next widget will get skipped. (If it is not clear, the code
- has other problems.)
-
- But none of you, and none of this code, has addressed the ONE THING for
- which comments are necessary, the ONE THING which they can do that code
- can never do, no matter how good.
-
- You haven't asked, much less answered, the ONE QUESTION that can assure
- us that this code is doing The Right Thing.
-
- You haven't told us
-
- WHY WE SHOULD BE SKIPPING THE NEXT WIDGET.
-
- What need is answered by skipping that widget? To what end, for the
- satisfaction of what final cause, must that execrable, unspeakable,
- fetid, repellant, malodorous, pestilential, obscene, shameful, squalid,
- fulsome, abominable, noxious, rank, infamous next widget be skipped?
-
- Tell me that, and then let me read your code to see what you've done
- about it.
-
- ``Say what you mean, mean what you say, do what you said you would do.''
-
- --
- (This man's opinions are his own.)
- From mole-end Mark Terribile
-
- mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
-