Re: Tutorial and guidelines: Coding standards (long message)

From: Programmer Dude (Chris_at_Sonnack.com)
Date: 06/14/04


Date: Mon, 14 Jun 2004 11:29:32 -0500

Otto Wyss writes:

>> if (foo < bar) {
>> fred(baz);
>> }

FWIW, I sometimes use this style, but overall I consider having the
braces in the same column far more readable.
 
>> is on a par readability-wise with
>>
>> if foo < bar then begin
>> fred(baz)
>> end;
>
> Yes. In a multi line statement "then begin" belongs together
> as if they are a single keyword.

I'm afraid couldn't agree less. (-:

To me, "begin" & "end" (only) are the delimiters. In various
languages, one might have:

    while x < 10 or while x < 10 do
    begin begin
        foobar(x) foobar(x)
    end end

And some might even allow just the begin/end for creating
a scope. So, I just can't see "then begin" as one keyword.

> I guess the most problems with braces comes from the fact that
> machines don't think as humans.

Machines don't "think", period. (-:

> Just look once into your phyiscal life. Have you ever stumbled
> across something aquivalent as braces?

I think comparing programming language syntax with real life is
a non-started, but even so, when I consider what scope delimiters
are and what they do, yes, similar occurs in real life.

The walls of my house or any package do the same thing. They
enclose and create a "private" space. Exactly as braces.

> Everybody has to make decisions all the time without considering
> that this immediatly opens up a block of actions.

I'd think most intelligent people would think the opposite. That
any decision does just that. If I decide to go out to eat, this
creates a block of actions: travel, parking, getting seated, etc.
And when those actions are complete, the decision is past.

> IMO the important part is the "if" and not the "brace" (BEGIN)
> either in real life or in code.

I submit that they are equally important.

-- 
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL  |
|_____________________________________________|_______________________|


Relevant Pages