C++ style question/criticism, was Re: Mozy Contest Answers

Levi Pearson levi at cold.org
Sat Nov 4 21:05:34 MST 2006

On Nov 4, 2006, at 8:48 PM, Dave Smith wrote:

> For me, readability has more to do with consistency than white  
> space usage or brace placement.


> I don't think either style is more or less readable, inherently,  
> but my mind has been trained to read the former, so I process it  
> more quickly.

Okay, I'll buy that you've trained yourself to read your way more  
quickly, so it's easier for you to parse what you see.  However, I  
gave a reason why a format that makes code more vertically compact  
would be objectively more readable, and you didn't really refute that.

Do you never need the context of what lies above and below your  
visible window into your code?  Maybe your memory is better than mine.

> I used to optimize my code layout for vertical compactness, but I  
> don't feel it has made any difference for  the readability of my  
> code *to me*. There are many better ways to make code readable than  
> white space, I've found, and they all have more to do with well  
> thought-out logic and good design.

Certainly there are other things more important to understandability  
than whether you put your braces on their own lines or not.  But that  
does not change the fact that you get way less on your screen when  
you litter it with semantically meaningless lines.  Better to combine  
good logic and design with good formatting, too.

So, if you used to use a more compact style, I assume you were used  
to it and you could parse it quickly.  Why did you switch?


More information about the PLUG mailing list