home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.software-eng
- Path: sparky!uunet!psinntp!ficc!rogers
- From: rogers@ferranti.com (keith rogers)
- Subject: Re: C code Layout
- Message-ID: <id.5BUV.CUB@ferranti.com>
- Keywords: comments
- Sender: rogers@ferranti.com
- Organization: Ferranti International Controls Corporation
- Date: Mon, 14 Dec 1992 23:37:56 GMT
- Lines: 46
-
- In <1992Dec13.152430.6370@mixcom.com> ttvvtt@mixcom.com (Donald Amby) writes:
- >
- > <...> (R.T. Herbst) writes:
- >
- > >While directing the eforts of 125 people in producing the
- > >A Data switching system for the Bell System- Good ol'
- > >Ma bell-- I asked for a sample of code. I founr the comments to
- > >be utter nonsense,. If one removed the code, the comments made no sense.
- >
- > Excellent point! The comments SHOULD make sense without the code.
- > I personally write code by doing the comments first. If I cannot
- > describe in clear concise sentences what I am attempting to do,
- > then I obviously do not understand the problem.
- >
- > I then add the code as I get the details of the implementation
- > worked out.
-
- What you are describing (to me, anyway) is design notes. I don't agree
- that comments must stand by themselves. A design, prior to coding,
- should meet that criteria, but once the code is written, the comments
- and code, together, should be used to convey the information necessary
- for proper maintenance of the software. Insisting that the comments,
- without the code, be comprehensible, insures that your comments will
- contain needless, redundant information. Commentary should be used to
- help people through obscure coding, and to document non-standard or
- unusual coding, e.g., where the "obvious" coding method would be
- different, and was not chosen for a specific reason. (This, so some
- future maintainer doesn't toss out all of your good work, after having
- scratched their head over it for many hours and finally deciding,
- incorrectly, that it would be quicker, better, and easier to simply
- rewrite the code in a manner already rejected, than to try and fathom
- what the original coder had in mind.)
- >
- > >It was better to let the code speak for itself. If fact the code
- > >was hidden in by the comments. Certainly we need well commented code.
- >
- > Organizations that are serious about quality should address the
- > comments as part of any code review. Of course, if there are
- > no code reviews you will never see the comments until you have
- > to make changes to the code.
-
- And you shouldn't be surprised to never see any comments, at all,
- ever, if you never have code reviews.
- --
- Keith Rogers (rogers@ferranti.com)
- (jus' me talkin', an' nobody else)
-