[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



I agree with everything Steve mentioned.  

One thing about naming variables - if there are 2 or 3 variables that are 
similar, you can keep their similar names as long as it's easily 
distinguishable.  An example I have now is 'batch num'. I have a program with 
the idea of a 'batch' of 100 and a 'batch' of 1000, made up of 10 'batches' of 
100.  To make things more confusing, there's a column in a table we already 
have called 'FAS_BATCH_NUMBER' that isn't either of those.  To distinguish the 
three, i usually prepend something : 
#hund_batch
#thous_batch
#table_batch



The only thing I would add is that I find it visually useful to have comments 
at the beginning of each procedure explaining what it does, and that for each 
procedure in that SQR the comments are formatted the same.  This allows someone 
to scroll down the program, and notice a) where one procedure ends and another 
starts, b) what a procedure does without digging into the logic for it.  It 
allows a 2nd programmer to come in and see what a program does (underlying 
logic) without getting lost in the nitty-gritty of the code, or missing a 
procedure somewhere in the middle.



!-----------------------------------------------------------------------!
! Procedure:    Set-Route-to-PS-Vars                                    !
! Desc:         Procedure to set up variables needed in for the insert  !
!               to the DEP/DEP3 tables.                                 !
!-----------------------------------------------------------------------!
begin-procedure Set-Route-to-PS-Vars

...

end-procedure Set-Route-to-PS-Vars

!-----------------------------------------------------------------------!
! Procedure:    Close-Last-Dep                                          !
! Desc:         Close previous (or last) deposit. Insert deposit to     !
!               PS_FAS_AR_DEP_SUM.  Reset deposit variables.            !
!-----------------------------------------------------------------------!
begin-procedure Close-Last-Dep

...

end-procedure Close-Last-Dep


-----Original Message-----
From: sqr-users-bounces+bstone=fastenal.com@sqrug.org
[mailto:sqr-users-bounces+bstone=fastenal.com@sqrug.org]On Behalf Of
Alexander, Steve
Sent: Monday, November 21, 2005 11:50 AM
To: 'This list is for discussion about the SQR database
reportinglanguage from Hyperion Solutions.'
Subject: 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

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