Nathan Hurst wrote:
Jon A. Cruz wrote:
Nathan Hurst wrote:
What's wrong with 'a tab is a tab'? Then everyone can pick the size they like. (I currently prefer 8, but I'm liable to change :)
Because then when you add any extra spaces, like for lining up params, comments, etc. they don't work anymore.
That's not true. If you use tabs for indenting and whitespace for alignment then it works everywhere.
For some cases, yes, but for other cases no. (and when discussing this point, it's best not to use a strawman like that article did)
Here's the first function I had in code that took two params (just looking for a sample):
void ColorSelector::setColorAlpha( const SPColor& color, gfloat alpha )
Let's tabify it using 4-step tabs: void ColorSelector::setColorAlpha( const SPColor& color, --->--->--->--->--->--->--->--->...gfloat alpha )
and using 8-step tabs: void ColorSelector::setColorAlpha( const SPColor& color, ------->------->------->------->...gfloat alpha )
and finally using 5-step tabs: void ColorSelector::setColorAlpha( const SPColor& color, ---->---->---->---->---->---->---->gfloat alpha )
Hmmm... uh oh. that last one looks like trouble. But that first one had the same number of spaces left. Lets see what we get when we view using different tab settings from the 'original' tab user:
4->8 void ColorSelector::setColorAlpha( const SPColor& color, ...................................................................gfloat alpha )
8->4 void ColorSelector::setColorAlpha( const SPColor& color, ...................gfloat alpha )
4->5 void ColorSelector::setColorAlpha( const SPColor& color, ...........................................gfloat alpha )
5->4 void ColorSelector::setColorAlpha( const SPColor& color, ............................gfloat alpha )
So it looks like it's fairly simple to show things breaking down. And for the alignment of things there I didn't even pull manual tricks. That's a common way for editors to format code. Emacs and DevStudio both do it, and I believe that VIM does also.
Most of the 'reasonable' projects I've worked with have settled on 'no tabs', and were the better for it.
Or you bashed them into using it. :)
Nope. I've not been lead architect on most projects over the last several years. Two of my leads have been PhDs (just in case one was assuming I've only been working in barbiarian land). Hard to bully those guys. :-)
(Also, I'm trying to break these follow-ups down to single issue)