Re: The Elements of Informix-4gl Style? (long)
Posted in 1992
Path: emory!europa.asd.contel.com!uunet!ispd-newsserver!kodak!music!amiano
From: amiano@music.Kodak.COM (Mitch Amiano)
Newsgroups: comp.databases.informix
Keywords: 4gl style
Message-ID: <1992Mar12.181116.15305@kodak.kodak.com>
Date: 12 Mar 92 18:11:16 GMT
References: <29B7A050.1042@tct.com> <1992Mar09.021316.10584@dickens.com> <29BC2DE7.7F9D@tct.com> <1992Mar10.210913.18231@dickens.com> <1992Mar12.000729.17820@StarConn.com>
Sender: amiano@music (Mitch Amiano)
Organization: Eastman Kodak Co., Rochester, NY
In article <1992Mar12.000729.17820@StarConn.com>, pmahler@StarConn.com (Paul Mahler) writes:
[...lots of good article deleted...]
|> The other issue is program looks
|> as far as indents and spacing and starting and stopping
|> statements. When should an if statement start and end?
|> What goes where in a case statement.
Have to throw my 2 cents in. I try to think of the code in
terms of its control structures as blocked statements.
A code block is begun with any keyword of the language,
and ends with the keyword or symbol which terminates the
statement.
Any keywords or symbols which are dependant clauses of a
statement should be visually identifiable with the block,
and are indented at the same level as the first keyword.
Groups of related statements (paragraphs ?) are separated
by at least one blank line. A more major break in groups of
statements is shown with more blank lines.
Clauses within statements begin their own sub-blocks,
and indentation follows. Keywords or symbols which terminate
sub-clause blocks are indented at the level of the originating
clause. These blocks may or may not be given leading and trailing
blank lines, depending on the size of the block.
If a block grows to greater than 24 lines, append a comment
containing the originating keyword or code to the last line.
I really don't care about capitalization one way or the other,
but it should be consistent.
Let me illustrate:
Function MyFunc()
Define
lEntity record like Entity.*
Input by name lEntity.*
On Key( Interrupt )
Case
When infield( col1 )
stuff...
When infield( col2 )
stuff...
When infield( col3 )
stuff...
End Case # infield()
After Input
some other stuff...
End Input # lEntity.*
Select *
Into gEntity.*
From Entity
Where col1 = lEntity.col1
and col2 = lEntity.col2
If ( lEntity.col3 <> gEntity.col3 ) Then
Display "Some stuff again..."
To sErrorMsgFld
End If
Return
End Function # MyFunc()
|> I would love to have a beautifier that made all the
|> code look the same. even, gag, perhaps at the expense
|> of all upper case KEYWORDS.
There is one. If I could only find it in my disk files.... :-(
I can't believe there aren't any other 4gl beautifiers out there.
If others are interested, maybe I'll look harder. I do know that
the one I have (somewhere) came in a package of 4gl utilities, and
it cost $50.
----------------------------------------------------------------------------
| Mitch Amiano Current Work Phone: 716-477-3506 |
| Software Contractor Address: amiano@music.kodak.com |
| Rochester, NY |
| 716-226-2024 |
----------------------------------------------------------------------------