
Tabs, spaces and your salary – how is it really? - matthewwarren
http://evelinag.com/blog/2017/06-20-stackoverflow-tabs-spaces-and-salary/index.html
======
j_m_b
Whenever this old debate comes up, I am reminded of this quote

“There's a good part of Computer Science that's like magic. Unfortunately
there's a bad part of Computer Science that's like religion.” - Hal Abelson

I don't worry about indentation because emacs does it for me. However, if this
is your personal pet peeve then you should provide all of your developers /
contributors with a plugin, script or other utility that formats their code to
your standards. This issue has long been solved programmatically and it is a
waste of mindspace to deal with it any other way.

~~~
leggomylibro
That quote reminds me of one of Joseph Campbell's - "computers are like Old
Testament gods; lots of rules and no mercy."

And to go along with that, some things like GNU Make still requires tabs,
which is definitely annoying when you have your editor set to autoconvert. And
some sects like Go or Python don't technically REQUIRE one or the other, but
still try to aggressively purge the heretics.

~~~
na85
Is that a limitation in GNU Make or is it an inherited limitation of m4?

In my experience, m4 is an arcane bit of software that surprisingly few people
know about and one that frankly should have been replaced years ago.

Personally, I try to never use autoconf because of this.

~~~
dasyatidprime
Tab as the prefix for command lines is a property of all Makefile formats I'm
aware of (though not of many other build script formats). Make itself
(including GNU Make) does not generally use M4, though both Autoconf and
Automake use it, often in _conjunction_ with Make, as part of the Autotools
suite which is also published by GNU.

So, none of the above, in itself. It is a historical anomaly which has been
preserved.

------
lmilcin
To make long story short, somebody discovered that developers who take care of
their code -- how it looks and how it is being processed in a code repository
-- get higher salaries.

I earn my living from converting each company I work for to use a proper
development process, and that more often than not includes migrating to Git.
Why would anyone want to use Subversion in the presence of clearly superior
tool, is beyond me.

Why this matters is, contrary to popular belief, not because Git is
distributed or is more sound technically. It is because it allows you to
create better and more readable commits by not requiring you to immediately
commit to a shared pool of code that you then aren't allowed to change.

This means that you can commit locally to your repository as soon as you do
any development. You can then work for however long you want to make your
changes structured correctly in a readable way which is akin to refactoring
code, only for changes. Only then you commit to the big ole repository
maintained by your company.

Good developers will recognize that the readability of your code and of your
changes is of paramount importance. They will prefer tools that make it easier
to create good and good looking code because they take pride in what they do.

~~~
IshKebab
Yes except that any code that looks good with spaces can look equally good
with tabs (or tabs-for-indentation, spaces-for-alignment).

I can't see any reason why git would work better with spaces than tabs so that
seems like a weak argument too.

~~~
lmilcin
Code with spaces looks always good. Code with tabs looks good if the other
developer has the same tab length, but will not look correctly if it is wildly
different, because of the right margin not lining up correctly.

~~~
IshKebab
> Code with spaces looks always good.

Only if you don't care about the indent size, which many people do (otherwise
we wouldn't be having this discussion).

I mean you may as well say everyone should use Times New Roman because then it
always looks good.

~~~
mjevans
You only say that because you're MIXING indent styles.

Tabs first, ALWAYS, one tab is one level of indent.

go fmt uses the UNIX lineage of defaulting to 8 spaces converting to a tab
(worded in reverse).

Your editor should easily display tab stops at a value that is ideal for you;
you could set this to 2, 3, 4, or any other value if it makes things more
readable to you.

------
pklausler
I used columns 7-72 for code for Fortran IV and I liked it.

I used 3 spaces for Pascal and PL/I and PLUS and I liked it.

I used no indentation whatsoever for APL and I liked it.

I used spaces for CDC and Cray-1 assembly, tabs for microprocessors, and had
no productivity difference.

I used tabs for C and I liked it.

I aligned everything on the ':-' in Prolog and I liked it.

I use 2 spaces for C++ and that's the only part of C++ that I like.

I use no regular pattern for Haskell and it's perfect.

It doesn't matter. Let your team's format zealot win this argument. Find
another hill to die on, like naming conventions or "using namespace std;".

~~~
thephyber
I expected to see "I used no spacing whatsoever for PERL and I liked it."

~~~
pklausler
For those who like things like Perl, Perl is exactly the sort of thing that
they like.

~~~
gbacon
Unfair [not to mentioned tired, boring, unimaginative, and overused]
stereotypes are awesome!

[https://perldoc.perl.org/perlstyle.html](https://perldoc.perl.org/perlstyle.html)

> Just because you CAN do something a particular way doesn’t mean that you
> SHOULD do it that way. Perl is designed to give you several ways to do
> anything, so consider picking the most readable one.

~~~
pklausler
I would appreciate it if you would describe the stereotype that you think that
the text of my comment somehow cast upon Perl programmers, other than the
intended tautology.

~~~
readams
For those who miss jokes about Perl tautologies, missing jokes about Perl
tautologies is exactly the sort of thing they do.

------
pflats
I keep thinking that "employer" is the biggest confounding variable here. A
quick survey of some of the big players, whom I would presume pay premium
salaries, seem to favor spaces over tabs.

e.g.

[https://google.github.io/styleguide/cppguide.html#Spaces_vs....](https://google.github.io/styleguide/cppguide.html#Spaces_vs._Tabs)

[https://docs.microsoft.com/en-
us/dotnet/csharp/programming-g...](https://docs.microsoft.com/en-
us/dotnet/csharp/programming-guide/inside-a-program/coding-conventions#layout-
conventions)

I can't find an Apple style guide, but the first file on the most recent
commit to Swift uses spaces as well.

[https://github.com/apple/swift/blob/e0f75bf841631a50f9ab6502...](https://github.com/apple/swift/blob/e0f75bf841631a50f9ab6502dc6c13b3abcaaf1c/stdlib/public/SDK/CoreGraphics/CoreGraphics.swift)

~~~
var_explained
That was an early hypothesis I considered, but it doesn't fit the data. That
would show up as a larger tabs/spaces salary gap for big companies, when in
fact the gap is similar across all company sizes:

[https://twitter.com/drob/status/875493967865008129](https://twitter.com/drob/status/875493967865008129)

Perhaps it could play a role as a more indirect effect: people leaving
Google/Microsoft/Apple/etc, starting new companies or joining senior positions
at others, and spreading this particular practice.

~~~
jcranberry
Only informative comment thread I've seen so far. I was wondering about this.

------
drostie
I think that the original article made it clear that it was a correlation, not
a causation.

There is probably some underlying cause to both trends, something like "there
are people who tend to be really ticked off about 'this operates slightly
different in two different environments', such people are more likely to (a)
use spaces and (b) have an engineering-type job that pays a little more."
Another possible correlation would be "people who are more worried that they
will someday have to SSH into a machine where they have not yet configured an
editor in order to insert debugging statements into the live production code,
tend to come from DevOps backgrounds that earn slightly more, and also tend to
favor spaces instead of tabs because that damn default tabstop is 8 and I can
handle 2, 4, and _maybe_ even 3, but 8 is too damn high..." or so.

I personally really preferred tabs in my youth as a sort of nod to democracy
and "everyone can set their tabstops however they like!" \-- and it was Python
that finally got me to use spaces instead, with the "hey when you want to do
multi-line stuff" arguments[1] and PEP-8 and community agreement and such. But
I do miss my little tab characters a lot.

[1] You know, stuff like "If you want to do multi-line stuff, then you need to
keep a conceptual split between using tabs for indentation but spaces for
alignment; and if you're using spaces for everything then you don't: you can
even use your tab key to insert many spaces at once. So it's tab-tab-tab-hit-
space-twenty-one-times versus tab-8-times-then-space-once. Worse, if you screw
up the mixed tabs-and-spaces format then you won't know about it unless tabs
are clearly visible by default, which adds visual noise to your file..." etc.
etc.

------
matthewwarren
If you're interested, here's some replies from the author or the _original_
article, discussing this post
[https://twitter.com/drob/status/877181598420135936](https://twitter.com/drob/status/877181598420135936)

~~~
shmageggy
I had the same thought
[https://twitter.com/drob/status/877179616322084864](https://twitter.com/drob/status/877179616322084864)

> _I 'm not sure I'd agree with the conclusion that version control breaks the
> indentation pattern found elsewhere_

The graph still looks like git-spaces is significantly higher

~~~
spinlock
but, git-tabs is higher than foundation-spaces.

------
passive
This seems fairly straightforward to me.

If you're collaborating, spaces are a much better default. If you're
collaborating, your job is harder than coding solo, so you should get paid
more.

~~~
jimmaswell
I work on collaborative projects, some use spaces or tabs and it makes no
difference to the ease of collaboration. It's just a setting in the
.editorconfig.

~~~
Peaker
In _all_ collaborative projects I've been that allowed tabs, all files that
had been edited by tab users were a mishmash of spaces and tabs that made no
single tab width configuration workable. If you chose tab width as 4, some
parts of functions would look right, others would have messed up indentation.
Ditto for any other tab size.

The theory of tabs for indent and spaces for alignment works. But when
collaborating, the practice requires too much support from tooling and too
much education for humans -- so it's just not worth the tiny benefit.

~~~
Veedrac
That's not a fair comparison. You either _disallow_ tabs, or you _disallow_
spaces. A mismatch isn't either, so it doesn't evidence either being better
than the other.

~~~
dxhdr
Disallowing spaces isn't an option, you can't align code using tabs. You have
to both disallow spaces and enforce a no-alignment (leading-indent-only)
formatting style.

Just use spaces! You can't mess it up. ;)

~~~
jimmaswell
Meticulously lining code up like ASCII art seems like an antipattern to me
nowadays. It might make some regions of the code look a little bit nicer, but
it's never really strictly necessary and it comes at the cost of higher
maintenance - for example, add to that list of assignments with lined up
equals signs and you have to make your addition line up too, and if your
variable name is longer than the longest one in the list so far you have to
move all the previous ones over.

------
thanatropism
Here's what she's still missing.

Models about things like salaries and prices have to be careful to disentangle
_supply_ and _demand_.

The insinuation when you hear that space-users earn more than tab-users is
that space-users are somehow more productive, sexier or in with the times.
When, as other commenters here have noted, large cool corporations tend to
contribute to and use open source code, which is more often space-aligned.

The money question here is -- can I improve my earnings potential by switching
to spaces? And this isn't solved by just noting that spaces correlate to Git
and open-source; what I need to know if switching to spaces (or using Git)
changes my supply of productivity-adjusted labor; or if it's just what they
use in higher-paying jobs.

Here's how you disentangle this: you pick a variable that correlates to X
(spaces vs tabs) but not to y (salaries). The textbook example is the demand
for foodstuffs. Regressing quantity bought versus price tells you very little
(supply and demand may be moving simultaneously); instead, you add something
like crop productivities as an instrumental variable to filter out the supply
effects and see the demand only.

[https://en.wikipedia.org/wiki/Instrumental_variable](https://en.wikipedia.org/wiki/Instrumental_variable)

------
jankotek
There should be a third option "do not know". This was important maybe 10
years ago. Today IDE is handling formatting for me, and I no longer remember
what the default settings are. The same about encoding or EOL chars.

~~~
khedoros1
> This was important maybe 10 years ago.

It's important today too, depending on details of the dev process. The IDE or
editor handles formatting, sure. Different ones do it differently though, and
keeping things consistent between environments often requires some
reconfiguration of the software (or automated converters on checkin/checkout,
if you want to go that far...)

------
davedx
In the Netherlands it is almost universal to discuss salaries in terms of
monthly salary amount.

~~~
gpvos
Yes, using the yearly salary as the main reference seems to be either a US or
an Anglophone-world thing. What is commonly done in the UK and Ireland?

~~~
freehunter
(In the US) I actually found it weird when I was talking to a loan officer and
he asked how much I made. I told him, and he about jumped out of his seat. _"
PER MONTH?! WHAT DO YOU NEED A LOAN FOR?!"_

I was flabbergasted. I'd never had someone ask me how much I make an expect me
to say per month. I don't know how much I make per month. I know per year or
per paycheck. If you want per month you'll have to get out the calculator,
buddy.

~~~
gpvos
In the parts of Europe that I know of, if you have a median job, your paycheck
_is_ per month. That is why everyone knows that number the best: it's the one
you see most often, appearing every month on your bank account.

~~~
mrkstu
So its possible to have to wait more than a month for your first paycheck?
i.e. start on the 1st and they pay on the 1st weekday of a new month for the
past month?

I'd hate to be loaning the company money that long every month.

~~~
geon
In sweden, salaries are traditionally paid the 25:th.

An if you get paid per hour, your payment is usually for the previous month,
so 56 days late.

~~~
gpvos
In the Netherlands also the 25th. However, if you get paid per hour, it may
also be that you are paid weekly or biweekly, but indeed usually a cycle
later.

------
luhn
Wait, did people take Stackoverflow's post serious enough to merit a response?

I enjoyed the original article and I especially enjoyed the semi-facetious
flamewar that broke out here on HN, but I thought it was pretty well
understood that it was a meaningless, albeit interesting, correlation.

~~~
marcosdumay
It patently obvious that liking spaces or tabs better won't change your
salary.

But it's also an incredibly clear correlation. It must be caused by something
(because it's too clear to appear by chance, and too stable on sub-
populations). It may be very interesting to find that cause.

~~~
Sean1708
_> It must be caused by something_

You'd be surprised: [http://www.tylervigen.com/spurious-
correlations](http://www.tylervigen.com/spurious-correlations)

~~~
marcosdumay
Spurious correlations normally aren't present on sub-populations (unless you
try to segment your population on many different ways, what they did, but it
was present on nearly all of the ways).

------
JoshMnem
The original story reminded me of this site:
[http://www.tylervigen.com/spurious-
correlations](http://www.tylervigen.com/spurious-correlations)

------
raverbashing
Given whitespace is immaterial to the end code (while it is used to indicate
blocks in Python, you could theoretically use something else to indicate
blocks) I have this idea of making each editor indent the code their preferred
way and have the canonical source code in an specific fixed way with no
alignments or needless spaces

------
koblas
Kudos to the author for doing a bunch of good data analysis and investigation.
Pro or con against the result it gives a better context in which to read it
rather than a simple headline that you can use in the next argument you have.

IMHO while the author touches on Git/OpenSource contributions as part of
higher salaries. What it also touches on is people who are working on
improving their skills and contributing understanding which is a different
individual than somebody who just takes surveys and works at a big company.

------
FrankyHollywood
Nobody said anything about actual workweeks yet. I'm a developer working 4
days a week, earning a very decent 5 figure salary, no complains :)

Now I can imagine if a company pays you >100k you have to work 40+ hours a
week. So annual salary should be corrected for actual working hours

------
simonh
When you have large amounts of data, even if it's for a large number of people
eventually youre going to find odd 'correlations' between unconnected
variables. People who play edition X of Dungeons and Dragons are 30% less
likely to eat chicken sandwitches than people who play edition Y. If you know
a thousand things about everybody, the data is going to be riddled with bogus
'connections' like this.

In this case it's too small a sample for this finding to be significant, but
increase the sample size and also increase the number of data points per
person and you get similar problems. Determining significance is not
straightforward.

~~~
var_explained
This is not the reason for the correlation. The p-value of the tabs/spaces
connection is about 10^-13 (one in 10 trillion), and it can be found
separately within each (large) country.

This does _not_ mean the effect isn't confounded with some other factor, but
it does mean it's not a multiple hypothesis testing issue.

You can explore the code and regression yourself! Take a look:
[https://github.com/dgrtwo/tabs-spaces-post](https://github.com/dgrtwo/tabs-
spaces-post)

------
KaoruAoiShiho
There are some good reason for using spaces instead of tabs and good reasons
but I'm sure it's mostly just a uniform. It's now a cultural meme that spaces
is better, and people who are exposed to this meme tend to be more connected
to the higher end of the community than people who aren't. It's like the
correlation of people who curse making lower salary and people who wear suits
making higher salary.

~~~
zild3d
Silicon Valley on HBO actually made the opposite conclusion, that tabs are
better (Richard did not hire someone because they used spaces). The main point
being pressing space bar 4, 8, 12 times etc is a waste of time

I think it also shows where a lot of people get confused, that being in the
"spaces" camp doesn't necessarily mean you are pressing the space bar each
time

~~~
matmo
I think his argument was also that spaces would take up 4 characters, whereas
a tab would take up 1. As a compression company, it "only made sense for him
to choose the lower character count".

~~~
khedoros1
For the sake of argument: "As a compression company", isn't data redundancy
exactly what they're supposed to handle?

------
nfriedly
I personally prefer tabs, but as suggested in this article, I do a lot of open
source work, and use git for that and my job and spaces seem to win for both.
So I use spaces.

Also, amusingly, when IBM hired me (in the US), my contract listed my salary
as $x per month. I'd seen it before from recruiters for jobs in London and
such, but I don't think I'd ever seen it put that way in the states before.

------
hellofunk
I've never understood the tabs versus spaces argument. It's not really a
question of a coder's individual taste, is it? Arent these things usually
decided by the choice of IDE?

For example, I use Emacs, and when I press the tab key, it is actually
inserting several spaces, not a tab character, at least in the language modes
that I use.

~~~
spinningarrow
But does everyone you work with use the same editor/IDE? I think that's where
problems begin (and are subsequently solved by the introduction of something
like editorconfig).

~~~
marcosdumay
Except from some niche Windows only tools, I've never seen an editor that
defaulted to tabs.

~~~
creepydata
Eclipse defaults to the tab character, at least for Java.

~~~
marcosdumay
Oh... That means I mix tabs and spaces on Java :(

I did never notice it.

------
gambiting
I'm from Poland and I can confirm - literally no one even thinks about their
salary in terms of a what it is annually - I suspect the author is correct in
thinking that a lot of Polish respondents wrote in their monthly, not annual
salary.

------
mmjaa
Honestly I've been avoiding this conversation for the last week, but it seems
the right time to bring it up: tabs are content.

Spaces are content.

They are both part of the _SET_.

Everybody, just give it up. They have their users. They have their uses.

(:set shiftwidth=4;noexpandtab)

------
cja
No sensible reader of the original SO article thought that correlation implied
causation in this case. Using spaces for indentation is obviously a symptom of
a better developer. That's all.

------
misterbowfinger
The point ------> .

\----> everyone upset about this story

------
bigtunacan
The article mentions in one sentence that PHP is also a factor, but then
provides zero indication of how so.

~~~
greaseball
Based on the survey results it looks like devs using PHP are paid
significantly less on average.

[https://insights.stackoverflow.com/survey/2017#work-
salary-a...](https://insights.stackoverflow.com/survey/2017#work-salary-and-
experience-by-language)

~~~
bigtunacan
Thanks for the link.

------
intrasight
Thanks. Now have new argument for my colleages to convince them to use spaces.

------
pavement
What, no graph of journalists salaries, comparing those who cover the
tabs/spaces debate, versus those who don't?

------
lcnmrn
How many spaces?

~~~
AlexCoventry
More importantly: vi, or emacs?

------
sacht
gofmt

------
kough
This author must use spaces.

------
justforFranz
Who gives a squat?

~~~
cholantesh
I thought this was a joke, but then I see all this earnest, heated discussion
over a non issue.

------
slartibardfast0
mixed

------
inanutshellus
= Why Grown-Ups Don't Use Tabs[1] =

* 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]void someNiceMethod(int myParamA,
        [tab][tab][tab][tab][space][space]int myParamB...);
    

(What you _should_ do--if you're going to visually align at all--of course, is

    
    
        [tab]void someNiceMethod(int myParamA,
        [tab]                    int myParamB...);
    

... but humans are humans and IDEs aren't created equal, so this doesn't
happen consistently.)

* 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 AND IDEs that let you treat spaces like tabs.

[1]: This came up last week
([https://news.ycombinator.com/item?id=14560042](https://news.ycombinator.com/item?id=14560042))
and this comment is shamelessly copied from that discussion
([https://news.ycombinator.com/item?id=14561223](https://news.ycombinator.com/item?id=14561223)).

~~~
hawski
Fuck alignment.

    
    
      [tab]void someNiceMethod(
      [tab][tab]int myParamA,
      [tab][tab]int myParamB,
      [tab][tab]...
      [tab]);

~~~
spinningarrow
Exactly. I never understood the benefit of alignment. I actually find it
harder to read - by making the starting point of the line less predictable
it's harder to skim through and if, say, you rename the function you've now
got a much longer diff than necessary.

After talking to several people, I've realised this is very subjective though
(what isn't!). I certainly prefer indenting only, without worrying about
alignment.

~~~
seanmcdirmid
> Exactly. I never understood the benefit of alignment.

Alignment is what makes ASCII art possible. Without alignment, we might as
well be using modern proportional fonts rather than old-fashioned type writer
fixed-width fonts ( _ducks_ ).

~~~
plopz
I know some of my coworkers still use mono-spaced fonts and I just don't
understand it. Proportional fonts are so much more legible and nicer to look
at.

~~~
khedoros1
I can't stand code in a proportional font. I like aligning code and having the
alignment be maintained, regardless of the specific font in use. Things tend
to also be more smooshed-together and hard to read individual characters when
using proportional fonts, since every character's width varies, instead of
matching the widest character.

Aside from that, in the stylistic sense, it's like reading a newspaper article
in cursive or an academic paper in comic sans.

Those are the things that struck me when I've pasted code into an editor with
proportional fonts, anyhow.

~~~
seanmcdirmid
There are other proportional fonts than cursive ones or Comic Sans MS. You
should just use better fonts.

~~~
khedoros1
Of course there are; I wasn't suggesting those as appropriate fonts. I was
using them as extreme examples of stylistic mismatch.

Proportional fonts have _less_ mismatch when used for code, but they still
tend to look "wrong" to me. A font like "Input" is attractive and offers
proportional and monospaced versions. You're still left with the larger
problem: fighting the font to line up data across multiple lines.

Maybe you don't care about that, but in both my hobby and professional
projects, I've found that alignment makes the code easier to read and easier
to work with. I would need a _very_ compelling reason to abandon that, and I
haven't seen one offered.

Going back to your original comment, you said:

> Proportional fonts are so much more legible and nicer to look at.

You also provided a convenient reply, which I think applies here:

> You should just use better fonts.

Hack, Input Mono, and a zoo of others are very attractive monospaced fonts.
You aren't stuck with whichever ugly ones you're thinking of.

~~~
seanmcdirmid
Character spacing, kerning, ligatures, and many other aspects of modern
typography are all that you give up with type writer fonts. Yes, if you use a
shit font like Times New Roman, it will look bad, but if you use a nice San
Serif font, it doesn't look as you described (like cursive, comic sans, or
another pseudo hand writing font).

Yes, you give up the ability to do ascii art in your code. I find that this
doesn't really matter to me or much of the code I use professionally (I can
open up some random javascript code off of GitHub and they don't do non indent
alignments). I guess if I was programming in C, this might be much more of a
problem.

------
danjoc
Managers hate him. Learn how to get a raise, using this one simple trick!

------
cr0sh
Ever since I started using spaces, my salary has increased dramatically!

I mean, when I first started, I was only making minimum wage. I had to use
tabs, my life was horrible!

Then I switched to spaces. Instantly, my boss noticed my increased
productivity, and my character count went up! I started getting free lunches!
My dogs became straight-A students! I started winning in League of Legends!

...and my salary increased by $90k! It was amazing!

