Live data from Hacker News

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

stackoverflow.blog

371–380 of 690 posts

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

#371

= 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…

You mean something like this don't you?

  [tab]void some nice method(int param a,
  [tab]                      int param b
So long as you only use tabs for indentation, not alignment, tabs look correct on _everyone's_ machine. The real problem with tabs is that (some) people are lazy and do stuff like this:

  [tab]void some nice method(int param a,
  [tab][tab][tab][space][space]int param b
Personally, I think if you work like that you need to learn to be professional and write code that follows whatever coding standard your organization uses. If they use tabs, the second example is _not_ following the coding standard.

So whether to prefer tabs or spaces, to me, depends entirely on how much you can/want to trust your coworkers to follow the coding standards.

Edit:

Or as pointed out below, change your coding style to this:

  [tab]void some nice method(
  [tab][tab]int param a,
  [tab][tab]int param b

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

#372

Earlier quoted context omitted.

> Tabs for indentation; spaces for alignment On a large code base with multiple committers, I've never seen this rule followed consistently. In fact, I think this shows a poor engineering decision: "Let's make a rule where everything looks OK 95% of the time, except when you change tab widths (which is, presumably, why we made the rule in the first place.)"

Well everything looks OK 100% of the time if everyone followed the rule . Sadly, human history tells us that's an invalid assumption to make.

Forcing people to remember relatively minor things is a poor use of headspace. Enforce a code formatter/linter, make the test suite success dependent on it, and never argue again.

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

#373
In case people aren't aware of it (I only found it recently), check out EditorConfig: http://editorconfig.org

It lets you check in an .editorconfig file that specifies whether your project uses spaces or tabs. And a bunch of editors and IDEs already have built-in support for it!

Doesn't solve the holy wars, but it can sure help reduce the friction.

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

#374

= 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…

There's actually a solid argument for "tabs for indentation, spaces for alignment", which solves both for preference and vertically aligning stuff: [tab]void someNiceMethod( [tab][space*20]int arg1 [tab]) But it basically requires having some visual indicator of what is a tab, which most people don't like. (edited for line breaks)

I like how it is in Sublime (2) - it shows whitespace characters on highlight.

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

#375
post #297

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…

If I were the candidate I will be giving mean looks while tapping the space bar as fast as possible! Spaces FtW! Ps. On a more serious note, the editor (actually the vim plugin) takes care of this.. default is 2 spaces for ruby and 4 for python (PEP8). I like ruby more, the identation too.

rant: a default unconfigured vim instance is a perfect example of my main issue with all this whitespace crap. Personally, I like tabs, but ultimately, like you mentioned, it doesn't matter with a well set up editor.

HOWEVER, a default unconfigured instance of vim is not capable of editing, for example, a YAML file in a valid manner without the user knowing that they have to manually set the tab character to spaces or mash the spacebar 1000000 times instead of using the tab key. Thats some REALLY horribly UX. It's not VIMs fault, and its not the YAML spec's fault, but it adds up to some bullshit.

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

#376

I see a few arguments here which suggest people think tab-users might care less about their code and/or their fellow coder. As someone who slightly prefers tabs and abhors mixing of tabs/spaces, I find this frustrating. I generally prefer tabs because I feel that they're more egalitarian: I like 4-space indentation, but don't want to force that on everyone encountering my code. Similarly, I find 2-space indentation v…

I agree with you and kinda wish people would take a combined approach. Tabs are better for indentation preferences. Spaces ensure that everyone sees the same thing, which can help in multi-line situations. So I wish people would avoid this black-and-white discussion. Use tabs for indentation, and spaces for multi-line alignment...

"So I wish people would avoid this black-and-white discussion."

^ complaint about "black-and-white" discussion

"Use tabs for indentation, and spaces for multi-line alignment..."

^ totally "black-and-white" solution

:-D

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

#377
post #314

I see a few arguments here which suggest people think tab-users might care less about their code and/or their fellow coder. As someone who slightly prefers tabs and abhors mixing of tabs/spaces, I find this frustrating. I generally prefer tabs because I feel that they're more egalitarian: I like 4-space indentation, but don't want to force that on everyone encountering my code. Similarly, I find 2-space indentation v…

Using tabs has the opposite of your intended effect: If there is any text which is vertically aligned beyond the first indent, then this alignment will break for anyone who doesn't have your tab width preference. They're then forced to change their editor settings to view your file in a non-broken way. I get way more pissed about someone else "forcing their preferences on me" when this happens than when I run into a…

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.

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

#378
post #56

Could it be that a few large, well-compensating employers are shifting the result? (E.g., https://google.github.io/styleguide/cppguide.html#Spaces_vs.... )

Could well be. I know that Google for sure requires spaces, and some cursory Googling leads me to the believe that Facebook does as well. Does anyone have information on Amazon, Microsoft, Apple, etc.? Of course, if all of the top companies are requiring spaces, then there's probably a reason for that, and its impact on salary data is thus meaningful, not just a spurious correlation.

>I know that Google for sure requires spaces

How do you know this? If this is the case, why did they make go fmt to use tabs?

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

#379

I see a few arguments here which suggest people think tab-users might care less about their code and/or their fellow coder. As someone who slightly prefers tabs and abhors mixing of tabs/spaces, I find this frustrating. I generally prefer tabs because I feel that they're more egalitarian: I like 4-space indentation, but don't want to force that on everyone encountering my code. Similarly, I find 2-space indentation v…

[deleted]

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

#380

Earlier quoted context omitted.

It's not really prejudice if those 'tabbies' are just inferior, is it?

I can't believe that in 2017 I'm reading comments containing blatant spacial prejudice on Hacker News of all places.

And here I was about to say that I can't wait for the spacist shitposts from the alt-tab
Post reply on HN