Live data from Hacker News

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

stackoverflow.blog

571–580 of 690 posts

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

#572
post #565

Earlier quoted context omitted.

> 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 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 news. One way to avoid this would be use a hanging indent. For example: print( 'some long…

This is the right way to do it always, because it is the consistent way. You'll always be indenting the same way everywhere if you do it like this.

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

#573

Almost certainly a result of the spaces cabal and the (often unspoken of) prejudice against tab users. Don't think you make hiring decisions based on tabs vs spaces? Well you're part of the problem, then. I'm building an app to help you easily email your congressperson and ask them to create legislation requiring space/tab equality. This has to stop. Please consider donating to my Patreon.

> Don't think you make hiring decisions based on tabs vs spaces? I actually ask candidates "spaces or tabs?" in every single interview. I don't really care what the response is in regard to the holy war, and it doesn't mean anything on its own, but having SOME thought out response can be a GREAT indicator of how well versed someone is in general. e.g. I'm going to think way more highly of someone that says "tabs, bec…

My answer would be that any modern software development shop should be using a linter like Rubocop, eslint or gofmt that runs automatically on every commit. It doesn't actually matter what standard a group chooses, but there is real cognitive overhead to trying to understand inconsistently formatted code. And, people shouldn't be the ones criticizing incorrectly formatted code; a GitHub robot should be.

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

#574

Earlier quoted context omitted.

> Don't think you make hiring decisions based on tabs vs spaces? I actually ask candidates "spaces or tabs?" in every single interview. I don't really care what the response is in regard to the holy war, and it doesn't mean anything on its own, but having SOME thought out response can be a GREAT indicator of how well versed someone is in general. e.g. I'm going to think way more highly of someone that says "tabs, bec…

This guy gets it. Tabs for indent, spaces for formatting within. No need to push your tab size standards on the next person to edit your code, and no need to force their editor to retab it to their preference, and back again when it's saved. "It's the editor's default", or worse, "I never really thought about it" are horrible reasons for doing anything, and hearing something else might be a sign of a pulse.

I also prefer tabs, but always make sure to write spaces to disk. The better you are with your editor, the less you have to worry about whether the original file was using spaces or tabs.

Therefore, writing 100% spaces to disk is the best way to insulate yourself from possible issues of people who _don't_ know what they're doing with spaces, tabs, or their editor.

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

#575

= Why Grown-Ups Don't Use Tabs = * Joe likes 4-space tabs, I like 2-space tabs, and Jane is old-school with 8-space tabs. * All goes well until someone aligns something visually, like so: void someNiceMethod( [tab][tab][tab][tab][space][space]int myParam...); * Now it aligns perfectly on my machine, looks mostly ok on Joe's machine, and is ON MARS on Jane's machine. Thus one-or-more of three futures happens: * Someon…

>All goes well until someone aligns something visually, like so:

I have been programming for most of my life, and I still don't know why people do this. I just don't feel the need to align stuff.

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

#576

Earlier quoted context omitted.

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.

Does anyone actually do that? I've never noticed that style in any code I've read, but maybe that just means it works.

I don't think anyone manually counts out their tabs and spaces, but I think every major text editor has a mode or plugin to make this automatic.

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

#577
post #415

Earlier quoted context omitted.

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…

I think he's saying use tabs on lines A, B, and C up until the indentation level (the "int"). Then on line B use spaces for all the whitespace from there until the text is aligned. /*t*/int f() { /*tabs*/int someVariableName = myFunctionCall(expr(5), //

There's no reason to do this silly mix of tabs and spaces. Just move all parameters to a newline have have sane consistency everywhere:

    int f() {
     someVariableName = myFunctionCall(
     expr(5),
     somethingElse(9),
     a_long * expression + involving(multiple.subExprs)
     );
     d = somethingElse;
    }

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

#578

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 feel it's a matter of style. I've resisted a long time, but then I've come to appreciate:

    some_function_name('some long thing',
        further, arguments)
Assuming a tab width of four, there is no problem with starting the second line with a tab. And the whole thing can be indented by tabs, as well (in which case the first line has N tabs and the second line has N+1 tabs).

The longer the function name, the better the advantage of indenting like this.

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

#580

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…

Spaces are only beneficial if you use styles with alignment. I dislike them: they sometimes look pretty, but they waste a ton of space on the left and don't work well in all situations.
Post reply on HN