
Developers Who Use Spaces Make More Money Than Those Who Use Tabs (2017) - nan0
https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/
======
dschnurr
Hopefully nobody uses an article like this to really inform their decision on
which to use.

Last month there was a reddit discussion that outlined some really compelling
accessibility-related reasons to use tabs, worth a read:
[https://www.reddit.com/r/javascript/comments/c8drjo/nobody_t...](https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/)

~~~
peterlk
This is one of the strongest cognitive dissonances that I have. And I have no
idea why it exists. I know that rationally, tabs are really the better choice.
Each user can choose how to display code in their editor.

But I just hate using them.

Maybe it was the 8 space default of vim (nano?) when I was sysadmining. Maybe
it was that there was inertia, and tabs are always the thing that's causing
problems. But I just can't get over it. I just don't like tabs.

~~~
ssully
I really think the split is almost purely a generational thing. If your first
exposure to computers/coding was using a terminal, I think you will end up
leaning towards spaces. If you grew up in the post GUI world on Windows or
Mac, I think you end up leaning towards spaces.

~~~
ldiracdelta
Purely a guess, but I think that spaces vs tabs is a proxy indicator of some
psychological difference. Perhaps it is conscientiousness. On some editors,
you have to go out of your way to change tabs to spaces. If you're very picky
about how your code looks and want it to always look the same in every editor
and to everyone, then maybe you use spaces. Personally, I do ascii diagrams
and even arrows inside of comments to point to different variables and make
comments on active code. I am very very picky about how my code looks. I know
code aesthetics isn't a be all end all, but maybe it could be some
psychological tendency like this. Also, I'm not a paragon of big bucks or
awesome, revolutionary code. Over time, perhaps conscientiousness or
fastidiousness keeps you employed or people give you more responsibility and
money.

------
lukev
All the tab advocates in this thread are like "Tabs are great, all you have to
do is..."

That's why spaces are better. There's no "all you have to do." There's
nothing. Just use spaces. Your code will look fine everywhere. Done.

Separation of content and presentation is a fine principle for many things,
but as long as we're coding using text files, we are already far removed from
that world. May as well stay simple and embrace the literal characters.

~~~
nemetroid
> Your code will look fine everywhere.

...or nowhere, depending on who is reading.

------
crazygringo
I think the biggest and most obvious control is missing here -- the company
they work for.

Much more likely is that companies that pay more, for whatever reason, insist
on spaces rather than tabs as a required coding style.

A quick Google search reveals spaces are used rather than tabs by Google,
Twitter, Mozilla, Facebook, Microsoft, Apple... so that already seems fairly
suggestive as the cause to me.

~~~
maxk42
Or the language they're working in. Python devs use spaces, go devs use tabs.

But I don't think the average Python dev makes more than the average go dev.

~~~
LordDragonfang
If you scroll down a little bit, they control for language and spaces are
still higher across the board.

------
dvt
I prefer spaces purely out of consistency reasons.

Some systems say a tab is 8 spaces, others say it's 4. Some editors can set a
tab to any customizable N spaces. But a space is _always_ a space so your code
will look like you intended (or should I say indented) it no matter who's
looking at it.

~~~
tedmiston
While I agree with you personally, I could see the counterargument of: A tab
is always a tab, and I can tweak my IDE to render a tab as however many spaces
I like (2, 4, 8, etc) without changing the code.

~~~
dvt
In a lot of cases though, you can't change what a tab is (consider looking at
code on GitHub).

~~~
ChrisSD
You can on Github but it requires using `?ts=4` in the url or committing an
editorconfig file. Perhaps there are extensions that do it automatically.

------
wwweston
In case anyone wonders why someone might answer "both" (other than an entirely
undisciplined approach):

Tabs for line indentation, spaces for every other kind of alignment is one
philosophy. It's the one that seems to hit the sweet spot for most of the
issues that I care about (cross-editor consistent yet flexible management of
line indentation depth as controlled by hits of the tab key + tabstop
setting).

But if you're running the project and decide spaces are The One True Way™,
I'll figure out a way to get the editor to do it for me and ask you for a
raise for the trouble (and, of course, market standards). ;)

~~~
umvi
> I'll figure out a way to get the editor to do it for me and ask you for a
> raise for the trouble

You don't have to "figure out" anything. It's the default of every IDE I've
ever used.

I press tab, VSCode inserts 4 spaces. I press shift+tab, it deletes 4 spaces.

Nobody actually presses spacebar 4 times to indent unless they are forced to
use vim on some remote machine.

~~~
wwweston
> It's the default of every IDE I've ever used

Which is probably not every IDE or editor.

> I press shift+tab, it deletes 4 spaces.

How entirely intuitive and not-awkward compared to hitting delete.

> they are forced to use vim on some remote machine.

Vim is not exactly unpopular as an editor of _choice_.

But overarching all that -- the ;) at the end of my comment should have been a
clue that _I was not sincerely arguing that figuring out how to use spaces for
tabs is an involved task_. Even somebody using vim (whether forced or by
choice) should know `:set expandtab`. Most editors worth investing in will
provide a convenient way of doing this.

Rarer are the editors that will also let you change indentation width on the
fly while expanding tabs to spaces, though, which is generally easy if you use
tab characters for indentation. I'm not super familiar with VSCode, but having
just fired it up and tried it out, maybe it can do this if you turn on Detect
Indentation, though it doesn't seem to be the default, and I haven't put it
through the paces for less trivial cases.

~~~
umvi
> How entirely intuitive and not-awkward compared to hitting delete.

Try it, you'll like it. Especially when you want to untab an entire block of
code instead of just one line.

\- Highlight entire block of code

\- shift+tab unindents entire block (whereas delete would delete entire block)

Plus, once you know a lot of shortcuts, `shift` seems to be sort of a negating
key so it actually starts to be intuitive. (i.e. in vim, if you are searching
for a string, "n" will move to next match, "shift+n" will move to previous
match)

------
rhacker
Wouldn't this make sense?

[https://medium.com/@hoffa/400-000-github-
repositories-1-bill...](https://medium.com/@hoffa/400-000-github-
repositories-1-billion-files-14-terabytes-of-code-spaces-or-
tabs-7cfe0b5dd7fd#.j6ki2b7og)

So the number of people that prefer spaces far outweighs the tabbers.

Now, take the pool of people that use spaces and tabs and let them compete for
a 100k job. 9 times out of 10 even if randomly hired it will be a space
person.

Also, as a by the way, on the medium post. The reason Java has so much tabs is
specifically due to the default Eclipse formatting that prefers a mix
Tab/Space approach. Which is absolutely horrifying in my personal opinion. I
don't have any numbers but Eclipse probably holds 80%, followed by Netbeans
and/or IntelliJ. (both of which default to spaces)

~~~
NobodyNada
> Take the pool of people that use spaces and tabs and let them compete for a
> 100k job. 9 times out of 10 even if randomly hired it will be a space
> person.

But you'll get the same result when they compete for a job that pays poorly.
If all other factors were equal, the distribution of developers who prefer
tabs should match that of developers who prefer spaces.

By your argument, people named Steve would make less money, because they're
outnumbered by people not named Steve.

~~~
hencq
This could still be true though. There are more likely to be outliers in the
large group than in the small group. However, there is a lower bound on the
number (nobody makes below $0), but no upper bound. So the distribution is
likely to be skewed.

So yes, people named Steve would make less money (though this argument might
not work as well for people named Jeff, Warren or Bill I guess).

~~~
Grustaf
I am not sure exactly what your argument is, but it doesn’t sound correct. The
differences will be larger in the smaller group, but the expected value for
the average pay in a group is independent of its size. That’s why you can use
a sample to find out something about a population.

------
TimTheTinker
I strongly favor spaces, because using tabs adds one more thing to worry about
when writing code to be read by others.

I suspect a lot of folks who work on large, multi-dev projects feel the same
way. We prefer to lay out our code and indentations with the expectation of
consistency for others. Spaces allow us to not worry "Will this be readable by
colleagues who prefer 2-wide tabs vs. 4-wide tabs?" We just adopt a convention
(2 or 4 spaces) for each codebase and run with it.

Similarly, when others have used spaces, it's one less thing to worry about
when starting work on a new codebase. There's no evaluating "will this
codebase look better with 2-wide or 4-wide tabs?" or "Can I override the
default tab width with my preference, or will that make this codebase less
readable?"

~~~
thfuran
> Spaces allow us to not worry "Will this be readable by colleagues who prefer
> 2-wide tabs vs. 4-wide tabs?" We just adopt a convention (2 or 4 spaces) for
> each codebase and run with it.

I don't get it. It allows you to not worry about it by letting you just say
"no, it won't be readable by you because we arbitrarily decided to make your
life difficult".

Tabs are the one that let you not worry about whether people who prefer a
different tab width will find the code readable because they can configure a
different tab width.

~~~
TimTheTinker
That may be true for codebases that _always_ use a single tab for each
indentation level -- I get that. But to stay readable regardless of tab width,
it requires a coding style that keeps indentation strictly consistent with
syntactic context (not an issue in Python, since indentation is syntactically
significant already).

It also limits what developers can do to align things in JavaScript, Lisp,
Ruby, C#, etc. -- especially when using complex call chains/lambdas, large
literal data objects, s-expressions, long parallel repetitions blocks of code,
etc. In those cases, using spaces is a huge benefit, because it provides a way
to scoot things left or right to make them more readable. With tabs, you can't
do that unless you mix tabs and spaces -- which is not cool at all.

~~~
thfuran
>With tabs, you can't do that unless you mix tabs and spaces -- which is not
cool at all.

There's no problem mixing tabs and spaces iff by 'mixing' you mean 'adding
some spaces for alignment after the tabs for indentation. Though I think there
are very, very few situations where that's actually meaningfully beneficial
over adding another tab beyond those for the nominal indentation of the block.

------
inanutshellus
This has come up before. My theory is this:

Tabs are great if you work by yourself. If you work with others, you need more
complicated rules to be followed like "tabs for indentation, spaces for
alignment."

So...

My theory is that coders using spaces have worked in more places and/or larger
places, which tend to end up paying more.

~~~
RussianCow
> Tabs are great if you work by yourself. If you work with others, you need
> more complicated rules to be followed like "tabs for indentation, spaces for
> alignment."

Except you don't, because you could just never align code, which completely
eliminates the problem. I find that aligning code is way more trouble than
it's worth.

------
vbtemp
It's just cause people using tabs are not using properly configured IDEs or
text editors, which reflects a lack of experience or adaptability, which
reflects the lower salary.

Edit: It's also kind of funny how people in this thread are making it seem
like there's some kind of controversy. There isn't: the question was settled a
long time ago.

------
m463
This can be summed up "developers with experience with others use spaces"

Tabs do not interact well with teams.

Spaces are a source of consistency for teams.

Basically, spaces have the same indentation for everyone sharing code while
tabs do not.

To set up spaces only in your editor requires a mindful effort.

[https://www.jwz.org/doc/tabs-vs-spaces.html](https://www.jwz.org/doc/tabs-vs-
spaces.html)

------
erichurkman
Or give up the fight over formatting in general and adopt a tool like [0]
Black, which has no rules or options to configure and only one correct style.
_You can have any any style you want, as long as it's black._

[0]
[https://black.readthedocs.io/en/stable/](https://black.readthedocs.io/en/stable/)

~~~
Shorel
I was going to complain about it, but I like all the formatting decisions made
by black.

------
benttoothpaste
I've always suspected that "go fmt" is a tool of income suppression...

------
maxk42
My personal preference is tabs and the reason I never hear given is that I
simply don't want to press a button two or four times when I can press it
once. When I type a single tab: bam! code indented. When I type backspace, the
indentation is removed. It's easy. When I'm using spaces -- even in an editor
that expands tabs to spaces -- I have to press backspace four times to de-
indent code. I end up de-indenting a lot of code because a pet peeve of mine
is unnecessary conditionals. For example if you'll pardon the formatting:

    
    
      if(cond) {
        flag = true;
      } else {
        flag = false;
      }
    

can often be represented as just:

    
    
      flag = false;
      if(cond) {
        flag = true;
      }
    

and in languages that initialize variables, often the first line can be
omitted as well.

I just feel like I'm stuck in molasses, having to go through several extra
steps whenever I'm writing code that compels the use of spaces over tabs. That
said: It's a personal preference and I'll use spaces where appropriate.

Most people's argument against tabs seems to have to do with vertically
aligning code. This is a shit argument, because tabs should be used for
indentation only. If your indentation is the proper number of levels then
spaces can be used for any remaining vertical alignment. Tabs should be used
for indentation, not vertical alignment.

Example:

    
    
      tabtabtabtabType myArray[] = {
      tabtabtabtabtab   123,    456,    789, 101112,
      tabtabtabtabtab131415, 161718, 192021, 222324
      tabtabtabtab};
    

It's not difficult and problems only appear when some n00b tries using tabs
between the numbers in the above example to line values up. If you do that
you're going to have a bad time.

~~~
umvi
> When I type a single tab: bam! code indented. When I type backspace, the
> indentation is removed. It's easy. When I'm using spaces -- even in an
> editor that expands tabs to spaces -- I have to press backspace four times
> to de-indent code

Newer editors like VSCode handle this correctly. Tab = add 4 spaces, delete =
remove 4 spaces.

But really, you should get in the habit of using tab to indent, and shift+tab
to deindent (not delete). shift+tab has the added advantage of being able to
deintent an entire highlighted block of code in virtually all editors.

> can often be represented as just:

Well, in this case you could just do `flag = cond` but I see your point

> Most people's argument against tabs seems to have to do with vertically
> aligning code. This is a shit argument, because tabs should be used for
> indentation only. If your indentation is the proper number of levels then
> spaces can be used for any remaining vertical alignment.

Well, a lot of people haven't configured their editors to visually see
whitespace, and since it is invisible by default, it means a lot of code with
mixed whitespace is committed which is a hard problem to solve. So you just
configure your auto-formatter to convert everything to spaces so there is no
ambiguity.

------
robocat
From the given data it appears that people that use stackoverflow are being
paid really really low wages. Maybe people who answer online surveys are
poorly paid?

My personal graphologist said that although tabbers earn more, they tend to be
more focused on their work and less altruistic, so they answer less surveys.

Sampling bias is difficult to avoid in the best designed research.

------
jshprentz
Back when communications and printing devices were much slower, we often chose
tab stops to reduce the number of characters sent. I have used this algorithm,
but I doubt it impacted my career earnings.

James L. Peterson, James R. Bitner, and John H. Howard, ``On the Selection of
Optimal Tab Settings'', Communications of the ACM, Volume 21, Number 12,
(December 1978), pages 1004-1007.

[http://jklp.org/profession/papers/tab/paper.html](http://jklp.org/profession/papers/tab/paper.html)

------
rfer34f
That is an old post (June 2017). I thought it was now accepted that people
should use tabs, until I read the comments here. From a recent post, Nobody
talks about the real reason to use tabs over spaces,
[https://news.ycombinator.com/item?id=20341354;](https://news.ycombinator.com/item?id=20341354;)
if you're visually impared, using spaces make for poor accessibility. Don't be
a dick, use tabs!

------
natvert
Ok, but 2 or 4 spaces?!

~~~
Dylan16807
3 looks pretty nice in a lot of code...

~~~
TimTheTinker
Please don't do that. Just... please... don't.

I will have trouble controlling my frustration if I ever have to work on a
codebase built with 3 spaces per indentation.

~~~
Dylan16807
There's zero logical reason to use a power of two, though.

------
spacehunt
If I'm reading the chart correctly, it seems that Go developers who use spaces
rather than tabs actually earn more? That's quite surprising.

~~~
nostrademons
It is. I wonder if it's an artifact of the _other_ languages used at the
organization, i.e. Go developers who use spaces are likely to be working on
utilities or support code for a product that's primarily written in C or C++
(and probably been generating revenue for a while), while Go developers who
use spaces are more likely to be working in green-field pure Go codebases that
are newer with less of an established market.

------
ChrisSD
More people drown after having eaten an ice cream.

~~~
firethief
Age is the obvious confounding factor; have you tried controlling for it?

~~~
im3w1l
And warm weather.

------
awkward
I wonder if this is related to acculturation. I would guess that people who
are trained as computer scientists or work in tech are exposed to arguments
over whitespace, and more self taught people are not. Not to say that spaces
are a more sophisticated choice, but that the higher paying sectors are more
polarized.

------
jaequery
Those who prefer tabs have clearly not experienced the nightmare of
collaborating with devs who were using spaces.

~~~
jaequery
I guess the same can be said for working with devs who Lint and those that
dont

------
Bootwizard
So where does using the "tabs to spaces" tool lie here?

I technically press the tab button but my edit inserts 4 spaces.

~~~
tedmiston
If it's rendered in your editor as spaces and committed to your repository as
spaces, then spaces.

I doubt many space users actually type spaces by hand (a common pseudo-
counterargument against spaces).

------
robbrown451
It seems to me that the benefits of tabs tend to are reduced as storage
becomes cheaper, as text editors get more powerful, and as various other tools
becomes smarter.

So people sticking with tabs are more typically "old-school" and stubborn in
all their approaches. And that can explain the pay difference.

~~~
mjevans
Tabs clearly indicate a specific level of indent.

Spaces may or may not be rendered to a specific width in different editors,
and in fixed width editors are equivalent to 'pixel perfect' rendering; the
difference between a dead tree rendering that is static and an electronic
metadata included document.

------
firemelt
I really don't understand the war behind this I always pressing tab button
when I want to tabs(giving more than one space) things

Does the war is about pressing tab button vs space button?

Or is it about the underlying of it?

Afaik when We press the tab button the editor is sending a space right? Then
what's with the fuss?

------
jaequery
This is why the world will never make peace. If we can’t even agree on
something silly as tabs vs spaces.

~~~
TimTheTinker
I don't think it's silly. I strongly dislike the ergonomics of contributing to
a codebase that uses tabs.

------
adchari
I would bet this is due to some hidden variable. Maybe older or more
experienced developers have a tendency to use spaces, so their compensation
reflects age/level/experience, not their choice of indentation?

~~~
adchari
Never mind, reading the article sees him cover at least the experience,
language, and location of the developers, and there is still a significant
difference.

Maybe the team aspect made a difference, or devs worked at companies with
strict style guidelines, which happened to be companies who pay well, or
because that company is on their resume, they make more later on?

------
crtlaltdel
i am always amazed at how much time people sink into these discussions :D as
if commonly formatted textfiles was the biggest concern people have in their
day-to-day ;)

------
writepub
Which camp does that put me in - I use the tab key for code indentation, but
my editor is configured to replace tabs with 4 spaces

~~~
Grustaf
Do you think the controversy is about what key you use?

~~~
writepub
Please, oh please, do tell me _what_ this controversy is really about.

------
travbrack
* based on one survey of self-reported data

------
commandlinefan
Probably because they can read their code.

------
sideshowmel
:set expandtab

------
dep_b
And what about developers that add spaces by using the TAB-key?

~~~
Sohcahtoa82
You mean _ALL_ of them?

Question for all of you tabs people...do you guys think that spacers are
hitting the space bar 2/4/8/X times?

~~~
for_xyz
Yes

[https://www.youtube.com/watch?v=SsoOG6ZeyUI](https://www.youtube.com/watch?v=SsoOG6ZeyUI)

~~~
Sohcahtoa82
Yeah I watch that show (I have a Hooli t-shirt!) and have seen that scene, and
honestly that's when I first started posing my original question.

------
Koshkin
4x or 8x ?

------
qzygr
I like tabs because it allows developers to configure their editors with
whatever width they desire.

~~~
inanutshellus
tabs don't work when you visually align code. e.g.

    
    
      some.method(param,
                  param2,
                  param3)
    

The above doesn't work if the creator of the code uses a different tab width
than I do. If you want it to, you need to use an IDE that automatically
recognizes the difference between indentation and alignment... which is
frankly too much trust in others if you care about it.

If a default install of an IDE (including vIM) will screw up your code.... you
might consider rethinking your strategy. :-)

~~~
insertnickname
That code would be misaligned anyway when someone changes the name of `some`
or `method`.

You should format it like this (regardless of whether you use tabs or spaces):

    
    
      some.method(
        param,
        param2,
        param3
      )

~~~
DHPersonal
That would be how I would do it, because generally the coding I do is simple
enough that I can trust Visual Studio Code to "Beautify" my finished work and
insert all the tabs it needs to align things.

------
tcmb
(2017)

------
leerob
For all my JavaScript developers - just gonna leave this here.

[https://standardjs.com/](https://standardjs.com/)

------
Grustaf
Can confirm

------
beardedProgmr
Those salaries are painfully low. I started at 75k. Who's making less than 50k
and in such great numbers? This must be non US jobs? I question this data.

~~~
elboru
99% of the planet would disagree with you:
[http://www.globalrichlist.com/](http://www.globalrichlist.com/)

~~~
beardedProgmr
We are talking about software engineers. I'm not talking about top company pay
either. I don't think I've ever gotten an offer for 50k

------
stephc_int13
Am I the only one who doesn't give a fuck?

Is it really a subject?

And I'm not saying that code aesthetics doesn't matter, I tend to obsess over
good typography and alignment, but I use both tabs and spaces, switching
depending on the code-base/context, without even thinking about it.

~~~
kpU8efre7r
Who gives a fuck about an Oxford comma?

------
buboard
Thats racist

It's probably related to the editor choices one makes? As a tabs-only person,
i am probably a little more autistic, a little less social (spaces are easier
to share with others), a little less open to new technologies.

------
nemetroid
I would be fine with using spaces if it weren't for all the spaces-users. More
specifically, how so many projects seem to go for the shortest common
denominator, often just two spaces. I mostly write C++, and agree strongly
with the rationale given in the Linux coding style for using 8-char tabs - it
promotes better design practices:

> Now, some people will claim that having 8-character indentations makes the
> code move too far to the right, and makes it hard to read on a 80-character
> terminal screen. The answer to that is that if you need more than 3 levels
> of indentation, you're screwed anyway, and should fix your program.

> In short, 8-char indents make things easier to read, and have the added
> benefit of warning you when you're nesting your functions too deep. Heed
> that warning.

