Live data from Hacker News

Developers who use spaces make more money than those who use tabs

stackoverflow.blog

441–450 of 690 posts

Re: Developers who use spaces make more money than those who use tabs

#441

Earlier quoted context omitted.

> Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. People who use spaces want to line up their '=' signs, that's fine, but I don't believe it's my position to enforce the amount of whitespace another…

> This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. I see this cited every time. Unfortunately, it's bogus in practice. Consider: print('some long thing', further, arguments) If this is an indented block, you'd have to indent the second line to the correct depth with tabs, then add exactly six spaces for alignment . You have to mix spaces and tabs, which is never good ne…

I'm pretty sure there's a circle of hell specifically for those who mix spaces and tabs.

That being said, this problem and problems like it can be solved simply by not aligning things visually:

    print(
        'some long thing',
        further,
        arguments
    )
Strictly adhering to indentation and never alignment can make the code a bit less readable, but conforming to a canonical indentation like this also makes it easier to reindent, move code around, etc.

I think that's what the argument really comes down to – alignment flexibility vs display flexibility. It's interesting to see which people generally prefer.

Re: Developers who use spaces make more money than those who use tabs

#442

Earlier quoted context omitted.

Who aligns like that? It seems to defeat the purpose of putting it on a separate line. void someNiceMethod( int myParam... ); Hey Presto! You, Joe and Jane all get your preferred size size of tab. As a bonus, this indentation style works equally well if Jim uses a non-fixedwidth typeface.

Non-fixed width typeface? That would be grounds for immediate termination.

You'd lose a pretty good employee then:

http://www.stroustrup.com/3rd_notes.pdf

> At first glance, this presentation style will seem ‘‘unnatural’’ to programmers accustomed to seeing code in constant-width fonts. However, proportional-width fonts are generally regarded as better than constant-width fonts for presentation of text. Using a proportional-width font also allows me to present code with fewer illogical line breaks. Furthermore, my experiments show that most people find the new style more readable after a short while

Great book, and I have used proportional fonts occasionally. It's much much better than you might imagine (as long as you are sane and use tabs for indentation). Obviously you can't get "perfect" alignment like you can with fixed-width fonts, but it is certainly nicer to read, so there is a trade-off.

Re: Developers who use spaces make more money than those who use tabs

#443

Earlier quoted context omitted.

Known as Poe's Law [1] [1] https://en.wikipedia.org/wiki/Poe%27s_law

I will don't understand why it's called Poe's Law if he said it in 2005. This phenomenon was well documented on Usenet by the early nineties.

If we called everything that was first described on Usenet as "Usenet's Law" then everything would be Usenet's law, probably even a couple of things in physics.

Re: Developers who use spaces make more money than those who use tabs

#444

Earlier quoted context omitted.

If you're looking for efficiency for text navigation/editing you should consider learning vim/using vim mode in your editor.

Every editor made for coding supports moving through whitespace with a single command.

This is extended to all text editing -- use ctrl to modify your movement (arrows, backspace, delete) to word boundaries.

Re: Developers who use spaces make more money than those who use tabs

#445
post #415

Earlier quoted context omitted.

Your issue is why you see people say "tabs for indentation, spaces for alignment." If you're trying to vertically align text, use tabs to keep it at the same indentation as the thing you're aligning to, and use spaces to adjust to vertical alignment. This will keep the vertical alignment regardless of the preferred width of the tab.

So for long lines to move an argument over to align with its predecessor on the previous line, like int f() { int someVariableName = myFunctionCall(expr(5), // ...you're saying line A is indented with tabs, and line B with spaces? Because that will misalign if your tab setting isn't the same. Or are you saying that both A and B are indented with spaces? Then what about line C, which will misalign with A and B if your…

A is indented with a tab.

B is indented with a tab, plus the requisite number of spaces to line up with the above line.

C is indented with a tab.

Re: Developers who use spaces make more money than those who use tabs

#446
post #355

Earlier quoted context omitted.

So how can it be a great indicator then?

an indicator is just that, an indicator. It doesn't mean anything on its own, but in the presence of additional information (interview question responses and discussions in this case) it can help paint a better picture. If someone answered this question with "what? I don't know/care", and then knocked more important questions out of the park, then it was obviously a bad indicator and isn't relevant.

I don't follow. Either their answer means something or it doesn't.

Re: Developers who use spaces make more money than those who use tabs

#447
post #355

Earlier quoted context omitted.

So how can it be a great indicator then?

an indicator is just that, an indicator. It doesn't mean anything on its own, but in the presence of additional information (interview question responses and discussions in this case) it can help paint a better picture. If someone answered this question with "what? I don't know/care", and then knocked more important questions out of the park, then it was obviously a bad indicator and isn't relevant.

[deleted]

Re: Developers who use spaces make more money than those who use tabs

#448
I blame whoever decided to make 8 spaces the default tab width on older systems. Yes, the beauty of tabs is that you can change the defaults and make one tab show up as whatever you want, but most people don't change the defaults. And 8 spaces is just too much more often than not.

From the Wikipedia article (https://en.wikipedia.org/wiki/Tab_key):

> A common horizontal tab size of eight characters evolved, despite five characters being half an inch and the typical paragraph indentation of the time, because as a power of two it was easier to calculate in binary for the limited digital electronics available.

Why someone decided to round up to 8 instead of down to a much more sensible 4 spaces is beyond me.

Post reply on HN