• Subject: Re: what is unclear about 01 02 03 -Reply
  • From: "Rick Baird" <rbbaird@xxxxxxxxxxx>
  • Date: Wed, 06 May 1998 09:41:37 -0500
  • Organization: Premium Systems, Inc.

Scott Swaim wrote:

> I have followed this thread from the beginning.  I have only one 
> question about any of the coding that has been displayed.  
> Wouldn't it be better if the code looked like this?

> C            If           (Amt$ > Warn$) AND                        Check 
>Amount against Warn
> C                        (Custcd < BestCD) AND                    Check Cust 
>Crd against Best crd
> C                        (Region = Midwest)                           Check 
>region
> C            Exsr      Warn                                                
>Warning subroutine
> C            Endif                                                            
>End Amt$, Custcd, Region

> With all of this talk about proper coding I have not seen one 
> mention of comment your code for "Others".  This is just an 
> observation.

Scott,

I understand your point, but in this particular case I don't think your version 
adds anything to it's readability.  Proof of this is
that you were able to add comments to code you didn't write and knew nothing 
about, contextually.

Well written code is self documenting.  

Comments are for establishing the "intent" of the code if that intend is fuzzy 
or the code particularly complicated.

It shouldn't be just a re-write of each line in suedo code.  The problem with 
over commented code is that after a few years and
programmers maintenance, comments can no longer be trusted to be correct. 

I comment my code, but too many comments can only make a program harder to 
maintain.
 
better use of comments would be:


 * check midwest region customers' credit and issue warnings.
 
C            If        (Amt$ > Warn$) AND            
C                      (Custcd < BestCD) AND          
C                      (Region = Midwest)             
C            Exsr      Warn                          
C            Endif                                      
 
Regards,

Rick
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].