Formatting of bootscripts

Ian Molton spyro at
Wed Jan 5 01:44:08 PST 2005

Bruce Dubbs wrote:
> Ian Molton wrote:

>> which is interesting, or perhaps misleading, I cant tell based on my 
>> own experiences. 
> Ian, I respect your opinions, but you make my case.  You say below that 
> when you first started, you found 8 character indents nearly 
> unreadable.  The fact that you now find them natural only shows that you 
> can adapt to a less than optimal presentation.

Not necessarily. there are many things lin life where humans adapt to 
the situation. eg. riding a bike - its easier to use stabilisers than to 
scoot, and easier to scoot than to ride freely, yet we strive to ride 
freely (partly because its faster, partly because as we get older our 
ability increases and we CAN ride properly).

However, remember Im not advocating a given indentation size, merely the 
use of tabs for indent and spaces for alignment. thus the presentation 
of the code is customisable by the user.

 > I note that 8 character
> tabstops reduce the available line length quite a bit.  That leads to 
> line wrapping which is really ugly and difficult to read.

OTOH, most cases where I've hit the limit (3-4 stops) there has usually 
been cause to rethink the algortithm in use...

> I guess I don't see the visual difference between spaces and tabs in 
> this situation.

There isnt one. its a semantic difference.

 > I agree that if you take the care explained in the
> earlier post, then another experienced programmer can adjust the 
> tabstops without harming the indentation level.  The problem I have is 
> just getting students to think about formatting at all.

Agreed - but perhaps by using tabs and spaces correctly, they will be 
able to learn this better - they can *count* the tabs wheras counting 
spaces quickly becomes unmanageable (in my experiences when I used to 
write in BASIC)

>> I urge you to reconsider the way you teach this to your students. 
>> Using spaces may be the quick (easy) fix, but it teaches no discopline 
>> regarding keeping track of the indentation / nesting. I find that 
>> people who understand this early on tend to become the better 
>> programmers.
> I'll think about it, but in some cases it's difficult.  In some of my 
> classes (e.g. html), the students have the option to use any operating 
> system.  Notepad doesn't have the option to set tab stops.

Wouldnt it be good to teach them about using an appropriate tool, and 
marking them down for failing to do so ?

> For instance, many projects use:
> if ( some condition) {
>   code;
> }
> but others use
> if ( some condition)
> {
>   code;
> }
> To create visually balanced braces.

however both the above take care to ensure that only the matter 
*between* the braces is indented.

> Also, the classic (K&R) pointer declaration is 'int *var', but the type 
> is really a pointer and other projects (Strostrup) use 'int* var' or 
> even 'int * var'.

A valid point.

> There are some coding standards I personally like better than others, 
> but to get along, participants have to adapt to the standards, not the 
> project.

How does this help people who want to work on a given project that is 
non-conforming ?

More information about the lfs-dev mailing list