C Indentation Survey Results (not long...)

Henry Spencer henry at utzoo.UUCP
Fri Apr 26 03:13:26 AEST 1985


>	What I was referring to was that I found it extremely hard to
>	read programs where the programming style changed (indentation
>	or otherwise) in the middle of the program.
>	...
>	This also applies to modifying someone else's code, too.  If
>	you're modifying someone else's code, you should use their style,
>	just to keep it consistent within that program.  ...

Very true.  No argument there.

>	I didn't say (or at
>	least didn't mean to say) that readability had anything to do
>	with whether or not the style matched anyone else's style.

But it does!

>	Just
>	as long as the same style is used throughout the program, the
>	next person that comes along can probably figure it out.
>	...
>	What I'm getting at is that most people can probably figure out
>	the style used in a program when they first start reading it.

Of course.  Somehow.  After a fair bit of head-scratching and cursing.
The whole point I was making is that "he can probably figure it out"
is a thoroughly unprofessional attitude.  You are supposed to make
*SURE* he can figure it out, by making your code as clear as possible.
The idea is to maximize clarity, not to aim for a minimum level and
claim that it's good enough.
	
>	Like I said before, my point was that it didn't matter as much
>	what style you used, just that you kept to it.  At least then
>	you give people an idea of what you're trying to do.

I agree 100% that keeping to a single style (at least within each
program) is more important than the specific choice of style.  But
this does *not* imply that the specific choice of style is unimportant.
To maximize readability, use what your reader is familiar with.
	
>	But I don't believe that just because you use a different style
>	than anyone else's, you're wrong.

Not wrong, no.  Unless you are writing programs that other people are
supposed to be able to read *easily*, i.e. programs that other people
will need to maintain or change.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list