Boost logo

Boost :

From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-07-22 23:41:17


From: "David Abrahams" <david.abrahams_at_[hidden]>
> From: "Vesa Karvonen" <vesa.karvonen_at_[hidden]>
> > It is not the amount of lines of code or how many identifier per line you
> have
> > that counts. What counts is that logic is not duplicated and code
> manipulation
> > is easy.
>
> Maybe
> for
> you
> , but
> I
> have
> trouble
> seeing the
> whole
> structure
> of
> a
> function
> when it
> is
> divided
> up that
> way
> .

"For Further Thought:

Point out to students that not all languages are normally written from left to
right. Hebrew is normally written from right to left. Traditional Japanese and
Chinese are written from top to bottom starting at the right side of the page.
Ask if any of your students know of other languages that are not written left
to right."

...

I really hate it when lines get too long. Traditional formatting styles tend
to require you to use special case formatting for parameter lists, which is
ugly and makes code more difficult to read.

Also, most text editors are strongly line oriented and it is usually difficult
to do column oriented editing in such editors.

However, the main intent of my formatting style is to close the formatting of
code while retaining the code open for modification (the OCP principle).
Consider the following abstract code template:

    a b
    aa bbbbbbbbbbbb
    aaaaaaa bbbbbbbb
    aaaaaaaaaaaaaa b

Although the above example is simple, you should notice that it is typically
formatted differently in order to make it easier to read:

    a b
    aa bbbbbbbbbbbb
    aaaaaaa bbbbbbbb
    aaaaaaaaaaaaaa b

Now suppose that you write the above incrementally:

1: a b

2: a b
    aa bbbbbbbbbbbb

3: a b
    aa bbbbbbbbbbbb
    aaaaaaa bbbbbbbb

4: a b
    aa bbbbbbbbbbbb
    aaaaaaa bbbbbbbb
    aaaaaaaaaaaaaa b

As you can see, the traditional formatting style forces the programmer to
revisit (or open) the formatting of lines of code that were written (or
closed) earlier. I really hate it.

The problem is magnified by the fact that I continuously refactor code as I
write it. So, I try to format code so that it does not have to be continuously
revisited.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk