[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] SQR Standards



Consider a book called "Code Complete" by Steve McConnell.  It is not
language specific but it covers programming style exhaustively (960 pages).
It will give you lots of ideas.

I've seen only a few programming standards for SQR, and they seem to be
written by some uptight person who has never programmed.  Please avoid
micromanaging the keyboard with rules like "the first letter of a variable
name should be capitalized and the rest of the variable name should be lower
case."  However it might be useful for everyone to agree that "words in
variable names should be separated only by dashes (or only by underscores,
or only by periods, or always by nothing)"

I believe a programming standard should (1) encourage good programming, (2)
discourage bugs, and (3) help the programmer who is trying to solve a
production problem at 2 AM.

For example, it is of supreme importance to consistently indent and
"outdent" programs to help someone follow the control structure.  In a big
shop, many programmers might touch the same file.  Therefore, there might be
rules about indenting.  But don't set the indents at 8 spaces - even
moderate nesting could run a statement off the screen.  (And while you're at
it, how about a rule setting the maximum level of nesting?)

How many bugs come from variable names that are too simple (loop counter #i)
or too easy to misspell ($o0p5_my_faux_pax) or too similar (#num_accts,
#num_acct, #account_no, and $account_nbr)?  How many bugs are due to using
the same variable for different formats (let $date = '2005-01-01' .... let
$date = '01-JAN-2005' ... if $date <= '2006-01-01') or (add #amt to #sum ...
divide #count into #sum)?

I like to encourage (not require) the use of variables or preprocessor
defined constants rather than literals.  It is easier to understand and
maintain:

if #found = 1         ! this could mean number of items found
or
if #found = {true}

while #item_number < 10
or
while #item_number < {num_items}

if $effdt > '01-JAN-1995'
or
if $effdt > {conversion_dt}


I could go on and on, but I ought to do some work for my employer now.


-----Original Message-----
From: tam kag [mailto:kaghdot@hotmail.com] 
Sent: Monday, November 21, 2005 9:09 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] SQR Standards

Hello,

I'm in the process of developing standards for SQR in my company, the 
standards should cover the diffrent elements of SQR, for instance it would 
cover coding, layout, file name, etc ...

Can any one point me to a resource to get some info on SQR standards.

any help is most apprecited.

Thanks

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users