comp.lang.ada
 help / color / mirror / Atom feed
* Another aspect of comments and coding standards
@ 1996-06-06  0:00 W. Wesley Groleau (Wes)
  1996-06-07  0:00 ` Dave Marshall
  0 siblings, 1 reply; 3+ messages in thread
From: W. Wesley Groleau (Wes) @ 1996-06-06  0:00 UTC (permalink / raw)



Brief rehash of recent suggestions (not necessarily all compatible):

1. Coding standards should make code more readable.
2. Coding standards should facilitate re-use.
3. Coding standards can be used to add semantics to the language,
   thus reducing the need for comments.
4. Code should be understandable with neither the coding standard nor the LRM.
5. It's going to a silly extreme to expect code to be understandable
   without the LRM.
4. Anything that can be expressed in the language instead of in comments
   should be.
5. Comments should be used to express abstractions at a higher level.
6. Comments should be used when the code isn't clear.
7. The code should always be clear.

I didn't do that just to re-start the argument.  Rather, I seek opinions
on a related issue:

When does using a language feature become a "clever trick" to be avoided?

What is the threshold between (1) keeping the actual code simple but not clear
(and filling in with comments) and (2) allowing complexity of code to
eliminate the need for those comments?

For example, which is better and why:

   if Value in Limit_1 .. Limit_2 then         if Limit_2 >= Limit_1 and
      -- note possibility of null range           Value   >= Limit_1 and
      -- [ see LRM 3.5(4) & 4.5.2(27-32) ]        Value   <= Limit_2   then

Examples with other language features also welcome.

I'm withholding my opinion lest those who agree keep silent.  :-)

---------------------------------------------------------------------------
W. Wesley Groleau (Wes)                                Office: 219-429-4923
Magnavox - Mail Stop 10-40                               Home: 219-471-7206
Fort Wayne,  IN   46808              elm (Unix): wwgrol@pseserv3.fw.hac.com
---------------------------------------------------------------------------




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1996-06-07  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-06  0:00 Another aspect of comments and coding standards W. Wesley Groleau (Wes)
1996-06-07  0:00 ` Dave Marshall
1996-06-07  0:00   ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox