A number of years ago I knew a guy who avoided using = as both
assignment and conditional, preferring to use = only for assignment
and EQ for conditions.  His rationale, which I agree with, was that it
removes ambiguity and forces spaces around the EQ to improve
readability.

That was probably 12 years ago at least, and I still try to do that
today because once you get used it it, it really does improve
readability, particularly months after the original implementation.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Les Hewkin
Sent: Thursday, March 03, 2005 9:05 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UV] making 00001 our of 1

I don't like to disagree with people BUT......

I like the first example best. Why not compare like with like

This is how I would write it

BEGIN CASE

    CASE RATE.INDICATOR = 5
         TOTAL.AMT = AMOUNT * MAIN.RATE

    CASE RATE.INDICATOR = 6
         TOTAL.AMT = AMOUNT * SECONDARY.RATE

    CASE 1 
         ERROR.CODE = INVALID.RATE.ERROR.CODE END CASE

We each have our own style. They are all just as good as each other.
It's just what you are used to.

Les.
-----Original Message-----
From: Adrian Matthews [mailto:[EMAIL PROTECTED]
Sent: 03 March 2005 14:55
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UV] making 00001 our of 1


Personally I find well spaced and structured code easier to read.
Consider the following:

BEGIN CASE
        CASE V=5
                TOTAL = AMT*RATE
        CASE V=6
                TOTAL = AMT*RATE2
        CASE 1
                ERR = 14
END CASE

Is much better as:

Begin Case
        
        Case RateIndicator = 5
                TotalAmt = Amount * MainRate
        
        Case RateIndicator = 6
                TotaAmt = Amount * SecondaryRate

        Case ELSE
                ErrorCode = INVALID_RATE_ERROR_CODE

End Case

Obviously ELSE and INVALID... are equates.

Humans can read mixed case a great deal easier than all uppercase and
the spacing helps the logic. Sensible variable naming negates the need
for comments.

All above IMHO and how long will this thread survive before going to
community!!

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mark Johnson
Sent: 03 March 2005 13:53
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [UV] making 00001 our of 1

IMHO I use the term 'overly grand' when i review existing prior code
on my current and new clients and there is a very large verbose nature
to it.
Not
being conclusive, but often times the code looks nice but there's way
too much 'air' in the program at the expense of being better in the
logic area.

Certainly I've not read everyone's code. But what I've seen over the
years has taught me that when I see grandness, that grandness takes a
200 line program and makes it 700. Case in point:

***************
*
* OPEN MD FILE
*
***************
    OPEN "","MD" TO F.MD ELSE
            ERRMSG="CANNOT OPEN THE MD FILE. PLEASE CONTACT YOUR
PROGRAMMER"
            GOSUB 90000
            STOP
    END
*********************
*
* OPEN PRODUCT FILE
*
*********************
    OPEN "","PRODUCT" TO F.PRODUCT ELSE
            ERRMSG="CANNOT OPEN THE PRODUCT FILE. PLEASE CONTACT YOUR
PROGRAMMER"
            GOSUB 90000
            STOP
    END
************************
*
* END OF OPENING FILES
*
************************

What gets me is the time spent to make the asterisks match the length
of the comments. I see your variable assignment style a lot yet if a
new variable were needed, say

CUSTOMER.LAST.SALE.DATE = ""

would you re-indent all of the other variables just to look pretty? (I
don't mean pretty in a derogatory way, I mean to spend your time and
the client's $ for something that really doesn't matter)

I know that there are some system-generated source code 4GL's that may
create the comments for you. But I can see past that with the
inconsistent content of the actual code.

There is a command which escapes me now that formats source code (not
necessarily databasic) in the editor to match old-school BAL
programming.
I've tripped over it by accident and then lose my changes as I EXit
and then re-edit to not have all the 'air'.

Some could argue that a 200 line program becoming 700 could fall under
the concept of standardized programming or making it easier for the
next guy.
Well, I'm that 'next guy' plenty of times and since it's very
inconsistent, it's certainly not a standard. I could write a book on
the wide variety of programming 'standards' I've inherited and the
ineffeciencies found.

It's unfortunate that in my travels the grandness happens to have a
related brother of reduced logic and a more brute force approach. It's
just harder to research with all of that clutter.

My 2 cents.
Mark Johnson

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <u2-users@listserver.u2ug.org>
Sent: Thursday, March 03, 2005 6:56 AM
Subject: Re: [U2] [UV] making 00001 our of 1


> Mark,
>
> I'm one of those programmers who use the "overly grand" way of
spacing
you
> describe. I believe that
>
> ASDTFY = ''
> AS         = ''
> DRT       = 0
>
> is much more readable than
>
> ASDTFY=''
> AS=''
> DRT=0
>
> especially when there is a lot more code than in this example, and 
> everything else around it is crammed together as tightly as it can
be
as
well.  Code is
> written for the human as much as the compiler, and I like it to be
as
easy
> to read (and spot errors) as possible.
>
> This spacing won't bother a find program if you wrote it or have the
source,
> and teach it better.
>
> My 4 cents.
>
> Regards,
> Charlie Noah
>
> [EMAIL PROTECTED] (mailto:[EMAIL PROTECTED])
writes:
>
> [snip]
> P.S. If you use my concept, you may want to have your search
strings
contain
> no spaces and convert to "" the spaces in each reviewed  line. There
is a
> overly grand way people program with spaces between  operators and
even
> though the complier doesn't care, FIND programs or the  editor will
miss
them
> if they don't match exactly.
>
> My 3  cents.
>
> ----- Original Message -----
> From: "Barry Brevik" [EMAIL PROTECTED]
> (mailto:[EMAIL PROTECTED])
>
>
> > >I have always used "R%5" but I may miss programs
> >  >that use other techniques to arrive at the same result.
> > >Can  someone give me examples that they have seen for changing 1
to
00001?
> >
> > I don't want to start a religious war, but I think it  is
completely
normal
> > to use:
> >
> >   NBR = NBR  "5'0'R"
> >
> >     or
> >
> >   NBR  = NBR"5'0'R"
> >
> > Barry
> >  -------
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


The information contained in this email is strictly confidential and
for the use of the addressee only, unless otherwise indicated. If you
are not the intended recipient, please do not read, copy, use or
disclose to others this message or any attachment. Please also notify
the sender by replying to this email or by telephone +44 (0)20 7896
0011 and then delete the email and any copies of it. Opinions,
conclusions (etc.) that do not relate to the official business of this
company shall be understood as neither given nor endorsed by it.  IG
Markets Limited and IG Index Plc are authorised and regulated by the
Financial Services Authority and, in Australia, by the Australian
Securities and Investments Commission.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

This e-mail and any attachments are confidential and intended solely
for the use of the addressee only. If you have received this message
in error, you must not copy, distribute or disclose the contents;
please notify the sender immediately and delete the message.
This message is attributed to the sender and may not necessarily
reflect the view of Travis Perkins plc or its subsidiaries (Travis
Perkins). Agreements binding Travis Perkins may not be concluded by
means of e-mail communication.
E-mail transmissions are not secure and Travis Perkins accepts no
responsibility for changes made to this message after it was sent.
Whilst steps have been taken to ensure that this message is virus
free, Travis Perkins accepts no liability for infection and recommends
that you scan this e-mail and any attachments.
Part of Travis Perkins plc. Registered Office: Lodge Way House, Lodge
Way, Harlestone Road, Northampton, NN5 7UG.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to