----Original Message----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Leach
Sent: Tuesday, September 27, 2005 1:49 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Good Programming Practice Question.........

> Kevin,
> 
> I disagree, for a simple reason:
> 
> I use alpha labels that make sense and then place them in the code in
> alphabetical order. Problem solved <grin>.
> 
> Just a few off the top of my head (it's late here):
> 
> 1. If using UniVerse, use mixed case to encourage readability
> when scanning
> through a program with upper case reserved for constants,
> common, file and
> select variables so they stand out as different, as in:
> 
> Fin = @False
> Loop
>   ReadNext Id From SLIST Else Fin = @True
> Until Fin Do
>   Read OrderRec From ORDERS, Id Then
>     GoSub ProcessRecord
>   End
> Repeat

This is style, rather than good coding practice.  To each their own. 

> 2. A GoSub should perform a single action. Jumping into a second
>    label inside a GoSub just sucks. Return To should be banned.

Nothing wrong with nested routines, but in that case RETURN TO is anathema.


This is one of the few really bad design flaws of BASIC, that they chose not
to use a separate keyword for returning from a GOSUB, or at least use a
separate return stack.  For example, if they'd paired: CALL ... RETURN and
GOSUB ... RTN, and CALL pushed to Stack1 and GOSUB to Stack2, then
implementing RETURN *anywhere* in the program would be as simple as CLEAR
Stack2; POP Stack1, and doing a RETURN TO from a secondary or tertiary GOSUB
wouldn't be a problem.

> [snip]
> Above all, be consistent. There are many good practices out
> there, most of
> them are common sense but they only work if applied consistently.

Amen to that.

-Keith
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to