I'm not saying banned. I'm saying that there's a popular leaning for the
logic statements and their predominant outcomes. IF happens to be THEN and
READ and OPEN happen to be ELSE.

In early days, IF only had THEN and ELSE was added later. READ and OPEN only
had ELSE and THEN was added later.

So IF X=1 ELSE is just someone's overly deviating way of confusing the next
reader. Why not use IF X # 1 THEN as it's the same thing.

As I scan a program, I see IF X = 1 and assume it should be a THEN. (no
flames on assumptions). If you review decades of code both old and new as I
have, you'll see that IF runs 99% THEN and OPEN runs 99% ELSE. The 1%
opposite is just causing trouble.

The READ does have a higher degree of using the THEN clause but in the
example below, I tend to like

READ REC FROM F1, ID ELSE CONTINUE

and saving one indent set and the END line.

I've inherited code from an idiot programmer that looks like this:

OPEN FILE1 TO F1 THEN
    OPEN FILE2 TO F2 THEN
        OPEN FILE3 TO F3 THEN
        LOOP WHILE READNEXT ID DO
            READ REC FROM F1, ID THEN
                WRITE REC ON F2, ID
                WRITE REC ON F3, ID
            END
        REPEAT
        END ELSE
            CANNOT OPEN FILE3
       END ELSE
            CANNOT OPEN FILE2
        END ELSE
            CANNOT OPEN FILE1
END

C'mon. Just because something can be done differently doesn't mean it's
worth a hill of beans.

My 3 cents.
----- Original Message -----
From: "Scott Ballinger" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, July 28, 2007 2:10 AM
Subject: Re: [U2] RE: Cleaner Case Statement


> On 7/27/07, MAJ Programming <[EMAIL PROTECTED]> wrote:
> >
> > [snip]
> > BTW, using IF X = 1 ELSE GOSUB 100 is also very hard to read. Sure it
> > compiles but source code should be readable for the programmers who have
> > to
> > visually interpet these things. EVERY IF should have an THEN as it's
> > predominately a positive test instead of a negative test. Then use IF X
#
> > 1
> > THEN GOSUB 100.
> >
>
> By that logic READ REC FROM FILE,ID ELSE ... should be banned as well?
> I think we are all pretty well conditioned to not be confused by the lack
of
> the THEN clause in this case. I suspect it is mostly what you are used to,
> and I think you can get used to quite a lot. Sometimes adding extra words
to
> make code more "readable" has just the opposite effect. It's all really
just
> personal preferences, but it feels more professional to call them
> "standards."
>
> my 0.02...
> /Scott Ballinger
> Pareto Corporation
> Edmonds WA USA
> 206 713 6006
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to