On 16/05/06, Rex Johnston <[EMAIL PROTECTED]> wrote:
Steve Holdoway wrote:
> Those who indent as follows...
>
> for ( initial configuration,...; End conditon; iteration action,... ) {
> do something...
> }
>
> are adopting a method designed to save paper on a hardcopy teletype, so
beware!
Ugh! Makes for unreadable code. Why do they teach this?
They teach this because:
1. Any half-decent programming editor is syntax coloured these days.
It makes it easy to read code that doesn't have a bunch of wasted
nearly blank lines.
2. Not having wasted lines with only a single char means I can see
much more of the program at once on the screen.
3. Many decent programming editors (e.g. eclipse) will be able to
autoformat syntactically correct code in whichever style you prefer.
There are offline tools for this also.
4. Books that teach programming don't want to spread their examples
over too much space.
Cheers,
Carl.