Re: The Elements of Informix-4gl Style?
Posted in 1992
Path: emory!swrinde!cs.utexas.edu!uunet!ddssuprs!lpc
From: lpc@dickens.com (Luis P Caamano)
Newsgroups: comp.databases.informix
Keywords: 4gl style
Message-ID: <1992Mar09.021316.10584@dickens.com>
Date: 9 Mar 92 02:13:16 GMT
References: <1992Mar5.021035.18374@StarConn.com> <29B7A050.1042@tct.com>
Organization: Dickens Data Systems, Inc.
In article <29B7A050.1042@tct.com> jim@tct.com (Jim Kunzman) writes:
>According to pmahler@StarConn.com (Paul Mahler):
>>
>>
>>Looking at most informix programs makes me want to puke. They
>>all look like they were written at terminals with organ pedals
>>instead of a shift key. Of course, this is only a small part of the
>>problem.
>>
>>Most C programs I have seen don't have this problem. If they
>>were written by generally competent programmers they are
>>generally well structured, well styled and easy to read.
>>
>>Most 4gl programs look like they were written by stupid BASIC
>>programmers. This seems to be an artifact of the very first
>>examples that came out of Informix where all the key words
>>were in upper case and lots of extra blank lines were inserted.
>>
>
>I have to agree with Paul. Proper use of lower case and/or mixed case
>makes code much easier to read. Early programs used upper case
>exclusively because of teletype limitations and terminal limitations.
>However, no magazine or newspaper would ever conceive of abusing
>readers by overusing upper case. Neither should programming languages
>or programmers. Uppercasing KEYWORDS is particularly annoying and
>causes me to pause and wonder why anyone would want to bother
>highlighting them. It decreases input speed for both the programmer
^^^^^^^^^^^^^^^^^^^^^^
I don't agree.
>and the reader. -Jim
I have to say that after you've written several apps in 4GL, you
don't need to read the keywords. Hence, uppercasing KEYWORDS makes
it easier to read 4GL code. Why? you'll read subsconciously the
keywords and use some cpu cycles (or brain cycles :-) to read only
the variables and table names.
For example:
select fielda, fieldb, fieldc, fieldd from tablea, tableb, tablec,
outer tabled where tablea.p_fieldx = vary.p_filedz andtablea.p_fieldy = vary.p_fieldy and tablea.fieldz = varz.valuex
order by fieldb, fieldc
versus
select fielda, fieldb, fieldc, fieldd
from tablea, tableb, tablec, outer tabled
where tablea.p_fieldx = vary.p_filedz and
tablea.p_fieldy = vary.p_fieldy and
tablea.fieldz = varz.valuex
order by fieldb, fieldc
versus
SELECT fielda, fieldb, fieldc, fieldd
FROM Tablea, Tableb, Tablec, OUTER Tabled
WHERE Tablea.p_fieldx = vary.p_filedz AND
Tablea.p_fieldy = vary.p_fieldy AND
Tablea.fieldz = varz.valuex
ORDER BY fieldb, fieldc
Obviously proper indentation helps, but look how easy one can spot
the OUTER keyword on the mixed version. If you write all your code
following this, soon you won't read the SELECT part nor the FROM,
WHERE, ORDER BY, etc
I could give more examples involving CASE statements, IFs, WHILEs,
long variable names, etc., but I think you got the idea.
I definitely prefer to uppercase the KEYWORDS and to use standard
indentation. After reading previous postings, it feels good to know
that there are other 4GL programmers that think like me.
However, this casing issue went to hell when I started using
Fourgen tools back in 1988 since their code is only lowercase.
At first I wrote a beautifier to uppercase the keywords but
I never finished it (I couldn't justify the time on the tool,
I needed to use that time writing the application instead). I was
glad to see that Snyder had such a tool. It wasn't that
bad to get used to all lowercase because the code is standard
(I mean generated, kind of the same thing in the same place) and
after a while I didn't care about uppercase or lowercase.
So, after all, if somebody ask me (like paul did) I'd say that
I prefer to uppercase the keywords, but at the end I don't care
as long as the code is at least properly indented.
--
---------------------------------------------------------------------------
Luis P. Caamano | lpc@dickens.com
Dickens Data Systems, Inc. | uunet!ddssuprs!lpc
Norcross, GA | (404) 242-5991
---------------------------------------------------------------------------
If you think you know it all, you'll stop learning. -myself
The more I learn, the more I know I know nothing. -somebody else