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, because then people can set the indentation render size to whatever they prefer in a way that doesn't affect other users" way more than someone who says "whatever my editor sets it to".
The reason I use tabs is pretty simple. It's faster to move around only using the keyboard. It's also faster if I'm changing code that requires reformatting. 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.
Brace yourself: I use two spaces after the end of sentences too. [1] I am quite the rebel.
Modern IDE's (Sublime Text) let you easily convert spaces to tabs (or vice versa) and intention length of existing code.
[2]
> 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 developer has to use in their editor. It's an accessibility thing, they might have their font size really large because of eyesight problems in which case 8 spaces is going to make reading the code a lot harder.
The fact that Python's rule used to be 8 spaces, then got changed to 4 thereby invalidating old code really showed me how shortsighted it is to use a set number of spaces in a whitespace sensitive language.
Well, of course. Only companies with fuck-you money can afford the extra bytes spaces take up versus tabs, so it follows logically that they'd pay their developers more.
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 very hard to parse in most languages, so I don't want that affecting me if I can get away with it. While this is possible with spaces and maybe a series of Git hooks, it's trivial with tabs.
On the other hand, I always use spaces in languages like Python or Ruby where there are well-codified style standards. I also always show invisible characters on any editor which allows it, and have cleanup scripts to ensure that whitespace is standardized across any non-vendor code in the project.
Maybe most tab users don't feel this way? Maybe most aren't as careful/picky as I am? Maybe tabs are more popular with younger devs? But I feel like tabs can offer more interoperability than spaces when many coders are working on the same project when the language/community doesn't strongly specify whitespace.
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 tidy, 2-space-indented file.
If you configure your editor to drop spaces when you hit 'tab', then the file is guaranteed to look the same for everyone, and stops being context-dependent-- a bad thing for plain text, IMO.
I think tab users are naive, misguided idealists rather than people who made a deliberate choice to screw over their fellow devs, sure. Tabs do indeed seem like they ought to be "more egalitarian" as you describe. It just doesn't work out that way in practice; it ends up more exclusionary because you wind up with a codebase that you can only work on if you have particular tabstops set up, rather than one that you can at least edit in any editor.
You are clearly being thoughtful, but the problem with tabs and mixing them into code is that when multiple people write the code, some spaces are going to slip into that tab heaven, and then indentation will break for someone.
So by choosing tabs, either the file must be consistently formatted with tabs by everyone always, or everyone must look at the code in the same editor configured in the same way always.
I remember reading jwz's rant on this long time ago and not getting it until I had the first what-is-going-on-here moment due to wrong indentation from mixed tabs and spaces. jwz is right. Stop using tabs.
My main reason for preferring spaces is that I have yet to work in any context where tabs occurred where it did not end up with mangled formatting sooner or later. Yes, often because it ended up being mixed with spaces, accidentally or intentionally, but nevertheless it seems to me to end with someone making a mess of it.
If everyone used tabs perfectly, I'd be fine with them...
This does not mean that changing from tabs to spaces will increase ones income.
I would expect there simply is a confounding factor that the author did not look at. Maybe the info is not in the data.
I can imagine that the space/tab choice is related to the "upbringing" of the developer. Maybe which language or editor they used first in their life.
Or maybe it's related to culture. For example when using IRC, tabs are usually not used to communicate. Maybe that impacts the general choice of tabs/spaces.
Or maybe more sophisticated users tend to exchange the tab key for something else:
Pretty simple: you use spaces because you're aware that there is more than one IDE/editor in this world and who knows what your code will get opened with tomorrow.
This means you consider consequences beyond "but it works on my machine" so you're a better programmer. Ergo, higher salary.
Almost everyone I know who uses spaces or tabs does so because that's either the default on their IDE, or for their language. So this holier-than-thou argument holds less water than the sun.
On the other hand, I find 2-space-indented code unreadable; in fact, 4-space wide indentation is the only size I find to be readable. I know plenty of people for whom that isn't the case. Using tabs lets the reader set the indentation level.
¯\_(ツ)_/¯
Edit: All the anti-tab arguments I'm reading below boil down to alignment. Don't align folks; there's good reasons not to align regardless of your indent style.
In fact, tabs are better for compatibility: other people might like other indentation sizes. If you keep your stuff consistently with tabs, and use spaces for alignment instead of having your IDE auto-replace tabs there as well, your code will look great with whatever tab size someone chooses. And extra pro: in dumb editors, you automatically get the right thing.
^^^ Exactly. Using tabs is a decent (albeit not perfect) indicator that you've never worked under source control on a large dev team with diverse working habits.
I think there's probably some truth to considering existing norms and thinking ahead, but find it unlikely to be the main confounder. How do tabs fail to work in other editors/IDEs?
That's exactly my experience, too. Developers who use default settings and tools are less interested in computers. Knowing the details of a system makes a developer infinitely more valuable.
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.
> 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.
A possibility I haven't seen mentioned is that the style guide of their employer, together with a few employers who pay out-sized salaries (Google, Amazon, Facebook...) could account for the difference.
Yes, the only reason to use spaces is because you are forced to because you work in an organisation that had to force this rule because it employs too many morons who cannot make the difference between indentation and alignment.
* Large organisation -> pays more.
* Organisation that has power to enforce coding style rules -> pays more.
The most confusing thing about this result is that go shows a high level of space-preferential salary difference. Go programmers who use spaces make ~20k more (at the median) than developers who don't.
Only, in Go, you don't have a choice -- gofmt enforces tabs only (with spaces for alignment). So something seems odd there.
Might also be that the space people, being irritatingly pedantic also include bonuses and/or stock compensation , while the tab people, always lazy and all over the place, just barfed the first number that came to mind.
The answer, as always, is: lisp with parinfer - makes the whole debate irrelevant.
If you're in the JS world check out https://github.com/prettier/prettier if you haven't. It's used by some big projects like React, Babel, webpack etc.
Unlike "traditional" formatters, it parses your code into a syntax tree completely disregarding any original formatting, meaning the output is entirely consistent. It's pretty liberating to devote zero time to manually formatting and can make code reviews more constructive and less superficial. It is what is is, and it's pretty opinionated based on Facebook's code style. Works great for us, enforced with a git hook.
I needed a good laugh this morning. But of course this is pretty bogus relationship. People who drive Teslas make more money than those who drive Gremlins.
But there's an actual causation here (you need more money to buy a Tesla). Use of tabs and salary don't seem to have any relation one way or an other.
My personal guess would be that using spaces is a practical decision and might be more popular towards older, more experienced devs (who are therefore better paid).
On paper tabs sounds better, they're "configurable", you should indent with tabs and align with spaces, yada yada and everything is good in the world.
In practice however it becomes a big mess real quick unless you only work on projects with very good and perfectionist developers who understand when they should indent and when they should align and how they should configure their editors to do the right thing. See for instance the linux kernel codebase, it looks like arse if you don't use 8-space tabs and the coding style even tells you to use that value (it shouldn't really matter if tabs were used "right", except maybe for 80-column limits). So why even bother with tabs in this situation? Do we really care that much about wasting a few bytes?
Therefore I gave up on tabs a long time ago and tell everybody to just use spaces in all the projects I maintain.
If you use tabs, you work for a small team (or by yourself),. If you use spaces, it's because you're in a "big enough to stop trusting everyone" environment.
[+] [-] austenallred|8 years ago|reply
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.
[+] [-] jdc0589|8 years ago|reply
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, because then people can set the indentation render size to whatever they prefer in a way that doesn't affect other users" way more than someone who says "whatever my editor sets it to".
Also, fuck spaces. Long live tabs.
[+] [-] lliamander|8 years ago|reply
[+] [-] ptero|8 years ago|reply
To achieve equality you should propose splitting a tab into four tabparts and equating each tabpart with a space. That's true égalité
[+] [-] _puk|8 years ago|reply
That's where your issue lies; subconscious prejudice is happening during the hiring process, you just can't see it.
[+] [-] wtf_is_up|8 years ago|reply
[+] [-] redm|8 years ago|reply
Brace yourself: I use two spaces after the end of sentences too. [1] I am quite the rebel.
Modern IDE's (Sublime Text) let you easily convert spaces to tabs (or vice versa) and intention length of existing code. [2]
[1] http://www.slate.com/articles/technology/technology/2011/01/...
[2] https://css-tricks.com/changing-spaces-tabs-sublime-text/
[+] [-] jinglebells|8 years ago|reply
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 developer has to use in their editor. It's an accessibility thing, they might have their font size really large because of eyesight problems in which case 8 spaces is going to make reading the code a lot harder.
The fact that Python's rule used to be 8 spaces, then got changed to 4 thereby invalidating old code really showed me how shortsighted it is to use a set number of spaces in a whitespace sensitive language.
[+] [-] piker|8 years ago|reply
[+] [-] timhwang21|8 years ago|reply
[+] [-] inanutshellus|8 years ago|reply
* 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:
[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:
* Someone implements a code re-formatter into version control
* Someone re-aligns the code, starting the process over again.
* Someone calls a meeting and demands we all switch to spaces
[+] [-] GavinAnderegg|8 years ago|reply
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 very hard to parse in most languages, so I don't want that affecting me if I can get away with it. While this is possible with spaces and maybe a series of Git hooks, it's trivial with tabs.
On the other hand, I always use spaces in languages like Python or Ruby where there are well-codified style standards. I also always show invisible characters on any editor which allows it, and have cleanup scripts to ensure that whitespace is standardized across any non-vendor code in the project.
Maybe most tab users don't feel this way? Maybe most aren't as careful/picky as I am? Maybe tabs are more popular with younger devs? But I feel like tabs can offer more interoperability than spaces when many coders are working on the same project when the language/community doesn't strongly specify whitespace.
[+] [-] tbabb|8 years ago|reply
If you configure your editor to drop spaces when you hit 'tab', then the file is guaranteed to look the same for everyone, and stops being context-dependent-- a bad thing for plain text, IMO.
[+] [-] lmm|8 years ago|reply
[+] [-] olau|8 years ago|reply
So by choosing tabs, either the file must be consistently formatted with tabs by everyone always, or everyone must look at the code in the same editor configured in the same way always.
I remember reading jwz's rant on this long time ago and not getting it until I had the first what-is-going-on-here moment due to wrong indentation from mixed tabs and spaces. jwz is right. Stop using tabs.
[+] [-] vidarh|8 years ago|reply
If everyone used tabs perfectly, I'd be fine with them...
[+] [-] fragsworth|8 years ago|reply
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...
[+] [-] unknown|8 years ago|reply
[deleted]
[+] [-] leblancfg|8 years ago|reply
wat
[+] [-] TekMol|8 years ago|reply
I would expect there simply is a confounding factor that the author did not look at. Maybe the info is not in the data.
I can imagine that the space/tab choice is related to the "upbringing" of the developer. Maybe which language or editor they used first in their life.
Or maybe it's related to culture. For example when using IRC, tabs are usually not used to communicate. Maybe that impacts the general choice of tabs/spaces.
Or maybe more sophisticated users tend to exchange the tab key for something else:
https://xkcd.com/1806
[+] [-] nottorp|8 years ago|reply
This means you consider consequences beyond "but it works on my machine" so you're a better programmer. Ergo, higher salary.
[+] [-] scrollaway|8 years ago|reply
On the other hand, I find 2-space-indented code unreadable; in fact, 4-space wide indentation is the only size I find to be readable. I know plenty of people for whom that isn't the case. Using tabs lets the reader set the indentation level.
¯\_(ツ)_/¯
Edit: All the anti-tab arguments I'm reading below boil down to alignment. Don't align folks; there's good reasons not to align regardless of your indent style.
[+] [-] tomsmeding|8 years ago|reply
[+] [-] SippinLean|8 years ago|reply
1 tab will render to whatever the next programmer prefers, it's only courteous.
[+] [-] peterbonney|8 years ago|reply
[+] [-] sambe|8 years ago|reply
[+] [-] yAnonymous|8 years ago|reply
[+] [-] lvoudour|8 years ago|reply
Sure, but how many spaces? grabs popcorn
[+] [-] andrewfong|8 years ago|reply
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.
[+] [-] Aaargh20318|8 years ago|reply
We finally compromised and we're using 3 tabs.
[+] [-] fcanas|8 years ago|reply
[+] [-] wott|8 years ago|reply
* Large organisation -> pays more.
* Organisation that has power to enforce coding style rules -> pays more.
* Morons -> they are paid more.
[+] [-] andrewla|8 years ago|reply
Only, in Go, you don't have a choice -- gofmt enforces tabs only (with spaces for alignment). So something seems odd there.
[+] [-] delegate|8 years ago|reply
The answer, as always, is: lisp with parinfer - makes the whole debate irrelevant.
[+] [-] Shorel|8 years ago|reply
[+] [-] tripzilch|8 years ago|reply
[+] [-] Androider|8 years ago|reply
Unlike "traditional" formatters, it parses your code into a syntax tree completely disregarding any original formatting, meaning the output is entirely consistent. It's pretty liberating to devote zero time to manually formatting and can make code reviews more constructive and less superficial. It is what is is, and it's pretty opinionated based on Facebook's code style. Works great for us, enforced with a git hook.
[+] [-] coldcode|8 years ago|reply
[+] [-] simias|8 years ago|reply
My personal guess would be that using spaces is a practical decision and might be more popular towards older, more experienced devs (who are therefore better paid).
On paper tabs sounds better, they're "configurable", you should indent with tabs and align with spaces, yada yada and everything is good in the world.
In practice however it becomes a big mess real quick unless you only work on projects with very good and perfectionist developers who understand when they should indent and when they should align and how they should configure their editors to do the right thing. See for instance the linux kernel codebase, it looks like arse if you don't use 8-space tabs and the coding style even tells you to use that value (it shouldn't really matter if tabs were used "right", except maybe for 80-column limits). So why even bother with tabs in this situation? Do we really care that much about wasting a few bytes?
Therefore I gave up on tabs a long time ago and tell everybody to just use spaces in all the projects I maintain.
[+] [-] corobo|8 years ago|reply
[+] [-] dx034|8 years ago|reply
If you know another variable that explains the difference please let us know.
[+] [-] coldtea|8 years ago|reply
[+] [-] Cacti|8 years ago|reply
[+] [-] andrewSC|8 years ago|reply
[+] [-] coldtea|8 years ago|reply
[+] [-] ubitaco|8 years ago|reply
[+] [-] autokad|8 years ago|reply
[+] [-] Cerium|8 years ago|reply
[+] [-] jmkni|8 years ago|reply
If a tree falls in the forest, etc
[+] [-] inanutshellus|8 years ago|reply
Case closed! :)