home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.software-eng
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!fcom.cc.utah.edu!mars.ced.utah.edu!bryant
- From: bryant@ced.utah.edu (Bryant Eastham,MEB 3116,581-5353)
- Subject: Re: C code Layout
- Message-ID: <1992Dec12.200619.29602@fcom.cc.utah.edu>
- Sender: news@fcom.cc.utah.edu
- Reply-To: bryant@ced.utah.edu
- Organization: Center for Engineering Design
- References: <1992Dec12.122453.8582@seq.uncwil.edu>
- Date: Sat, 12 Dec 92 20:06:19 GMT
- Lines: 48
-
- In article 8582@seq.uncwil.edu, herbst@seq.uncwil.edu (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.
- >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.
- >Too many comments that try to say what the code is saying are IMHO
- >distracting. The code in this case was assembler. Since that time
- >higher level languages came into use. In particular C language.
- >My philosophy is to let the language speak for itself. Add comments
- >where necessary. Again while directing the efforts of hundreds of
- >people on the Safequard Anti-Balistic Missile System, we set standards
- >for commenting that let the code be seen. The project met its objectives
- >and schedule -- one of the few in that time frame.
- >Flame on and damned be he or she who flames out.
- >herbst@seq.uncwil.edu
-
- Anyone can get lucky a couple of times. ;-)
-
- If you believe that K&R is "about right", then we will never
- come to agreement on what the right amount of comments is.
-
- There is a difference between "letting the code speak for itself" and
- trying to let the code explain the algorithm. Clearly, lines like:
-
- i = i + 1; /* Increment i */
-
- are useless and cause "clutter" that should be "avoided". But the
- same line:
-
- /*
- * 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;
-
- can be a lifesaver for some poor person trying to maintain the
- code at a later time. The fact is that the second comment is
- MUCH larger and could even "hide the code", but there is no
- way that I will stop putting such comments in my code. I care
- too much for those who will follow me.
-
- Bryant Eastham
-
-
-