Developers Who Use Spaces Make More Money Than Those Who Use Tabs

by David Robinson

on

Do you use tabs or spaces for code indentation?

This is a bit of a “holy war” among software developers; one that’s been the subject of many debates and in-jokes. I use spaces, but I never thought it was particularly important. But today we’re releasing the raw data behind the Stack Overflow 2017 Developer Survey, and some analysis suggests this choice matters more than I expected.

Spaces make more money than tabs

There were 28,657 survey respondents who provided an answer to tabs versus spaces and who considered themselves a professional developer (as opposed to a student or former programmer). Within this group, 40.7% use tabs and 41.8% use spaces (with 17.5% using both). Of them, 12,426 also provided their salary.

Analyzing the data leads us to an interesting conclusion. Coders who use spaces for indentation make more money than ones who use tabs, even if they have the same amount of experience:

Indeed, the median developer who uses spaces had a salary of $59,140, while the median tabs developer had a salary of $43,750. (Note that all the results were converted into US dollars from each respondent’s currency). Developers who responded “Both” were generally indistinguishable from ones who answered “Tabs”: I’ll leave them out of many of the remaining analyses.

This is an amusing result, but of course it’s not conclusive by itself. When I first discovered this effect, I assumed that it was confounded by a factor such as country or programming language. For example, it’s conceivable that developers in low GDP-per-capita countries could be more likely to use tabs, and therefore such developers tend to have lower salaries on average.

We could examine this by considering whether the effect occurs within each country, for several of the countries that had the most survey respondents.

The effect is smaller in Europe and especially large in India, but it does appear within each country, suggesting this isn’t the sole confounding factor.

As another hypothesis, we know that different types of developers often use different indentation (e.g. with DevOps developers more likely to use spaces and mobile developers more likely to use tabs), often because they use different editors and languages. The Developer Survey asked both about what programming languages each respondent uses (Python, Javascript, etc) and what “type” of developer they are (web developer, embedded developer, etc).

Did we see the same tabs/spaces gap within each of these groups?

Yes, the effect existed within every subgroup of developers. (This gave a similar result even when filtering for developers only in a specific country, or for ones with a specific range of experience). Note that respondents could select multiple languages, so each of these groups are overlapping to some degree.

I did several other visual examinations of possible confounding factors (such as level of education or company size), and found basically the same results: spaces beat tabs within every group. Now that the raw data is available, I encourage other statisticians to check other confounders themselves.

Estimating the effect

If we control for all of the factors that we suspect could affect salary, how much effect does the choice of tabs/spaces have?

To answer this, I fit a linear regression, predicting salary based on the following factors.

  • Tabs vs spaces
  • Country
  • Years of programming experience
  • Developer type and language (for the 49 responses with at least 200 “yes” answers)
  • Level of formal education (e.g. bachelor’s, master’s, doctorate)
  • Whether they contribute to open source
  • Whether they program as a hobby
  • Company size

The model estimated that using spaces instead of tabs leads to a 8.6% higher salary (confidence interval (6%, 10.4%), p-value < 10^-10). (By predicting the logarithm of the salary, we were able to estimate the % change each factor contributed to a salary rather than the dollar amount). Put another way, using spaces instead of tabs was worth as much as an extra 2.4 years of experience.

Conclusion

So… this is certainly a surprising result, one that I didn’t expect to find when I started exploring the data. And it is impressively robust even when controlling for many confounding factors. As an exercise I tried controlling for many other confounding factors within the survey data beyond those mentioned here, but it was difficult to make the effect shrink and basically impossible to make it disappear.

Correlation is not causation, and we can never be sure that we’ve controlled for all the confounding factors present in a dataset. If you’re a data scientist, statistician, or analyst, I encourage you to download the raw survey data and examine it for yourself. You can find the code behind this blog post here if you’d like to reproduce the analysis. In any case we’d be interested in hearing hypotheses about this relationship.

Though for the sake of my own salary, I’m sticking with spaces for now.

  • Keith Hultman

    That is quite an interesting result. The fact that it is found in every language is impressive. As a tab user, I don’t think switching to spaces will have an effect on my salary or job prospects as I think the confounding variable here is probably coder personality and attention to detail. Did you look at age?

    • Pasquale

      “I think the confounding variable here is probably coder personality and attention to detail.”

      ^^^ This.

      And also: experience with source control and collaboration.

      • Interestingly, the author claims that experience is considered to be a confounding variable. Can you gain experience, yet, as a lone programmer? Perhaps, so this is a great point about collaboration. It’s usually when you collaborate you find out that your tab-settings are incompatible with other people’s settings, because they either use spaces, or a different indentation settings for tabs.

    • Draco18s

      I’ve certainly never been asked if I use tabs or spaces during an interview. Or after I was hired. Or really in any context other than the online holy war…

    • I think it’s more likely that spaces are just more prevalent in a certain type of commercial environment that also happens to pay higher salaries.

  • Eric Hydrick

    Did you look at number of languages space vs. tab users know and/or use? I’d imagine being a polygot would command a higher salary, and it’s possible space users tend to know more programming languages than tab users.

  • Vidhyashankar Madheswaraswamy

    I guess we need to look the other way. Developers who earn more ( are obviously Good at what they Do), Prefer spaces than Tabs. This can be inferred that better programmers prefer spaces.

    • > Developers who earn more (are obviously Good at what they Do).

      This is a very poor deduction.

    • Nick Odaemus

      You *can* infer that, but it’s foolish. There are so many personality factors behind those two statistics! Developers who earn more ≠ better programmers; they may earn more
      based on their assertiveness with raises and beginning salary alone, which has nothing to do with their programming quality.

  • Václav Haisman

    Spaces master race!

    • We can do without the Nazi references thank you,

      • It’s actually a Zero Punctuation reference, interestingly enough.

        • CeeBee

          Which was a reference to . . .

      • Václav Haisman

        lol, it is not a Nazi reference. Know your meme.

  • Chris

    Isn’t it more likely that older developers who are locked in their ways use spaces, and since they are older they are more experienced since they have been developing longer and thus make more money in general. Like in decades past you could probably say people who smoke make more money.

    • Izkata

      No. The very first chart is about years of experience.

      • CeeBee

        Years of experience; Not age.

    • Victor Lewis

      Check the x axis

    • Read the article – not the headline 🙂

    • Read the article. The very first graph plots age, and it starts out with spaces over tabs, and continues. Nothing to do with older age. Plus, a modern PHP developer who has adopted the PSR coding standards isn’t “locked in their ways”; it’s a prevalent coding standards that’s become widely-adopted.

  • Lundin

    All professionals know that you cannot write source code that contains tab symbols, because such
    code will always turn into an unreadable mess whenever exported (for example when posted on SO). Therefore all professionals tend to know that you configure your text editor to insert spaces upon tab, which tends to be the default setting in almost every IDE out there. Then you can indent by pressing the spacebar or by pressing the tab key and it doesn’t matter. Assuming you know these things, the question “tabs or spaces” doesn’t even make any sense.

    • Jit

      unless you also configure your IDE to magically delete 4 spaces on pressing backspace after an IDE inserted 4 space block, there’s serious chances of messing up the formatting of your code. This risk goes even bigger if you have junior devs working on the codebase.

      • Lundin

        How? Most editors don’t delete 4 spaces but 1 when you press backspace. You will have to be pretty damn oblivious to your own source code if you don’t notice that the marker isn’t where you want it to be. Really, this whole “tab vs spaces” is a non-issue that doesn’t exist. All professional source code out there that uses space tokens, because insert-space-upon-tab is industry standard. I have no idea why I am the only one raising this question… nobody else used a source code editor before?

        • Mike

          I’m with you on tab’s converting to spaces 😀

          Jetbrains IDE’s delete 1 space upon backspace, and depending on coding style, will insert 2 or 4 spaces upon tab.

          You can then remove the indents by using shift+tab.

          After selecting multiple lines you can indent / unindent as much as you like with tab. pressing space just deletes the block of code.

          Maybe these anti-tab people are still using vi / notepad that keeps tabs as tabs?

          • The “anti-tab” people do the same thing as you (e.g., I use vim and it also can insert spaces on tab, just like most IDEs can insert “soft tabs”). We frequently press the tab key just like normal people, we just want that to map to spaces, not tabs. On the other hand, the pro-tab people use actual tabs, that is the 0x09 character, in their code.

          • Mike

            Ah okay thanks. I prefer spaces, and will generally swap any tabs I find over to spaces.

            I think there is some crossover in the discussion on this page about use of Tab key vs actual tabs in code. In general it seems fine to use the tab key, providing it maps to spaces.

        • klmr

          What terrible editor is this?! Most/all editors I’ve encountered are configurable to have backspace undo one level of tab indentation, even when tabs are converted to spaces.

          The last time I can remember an editor didn’t do this was ~ a decade ago.

      • Mike

        shift+tab will undo the spaces inserted with tab.

        Also, don’t most IDE’s have an option to auto format code?

    • Bryan Oakley

      This sounds like a “No true Scotsman!” argument.

  • sqd

    I was expecting that people who use both make much less money…

  • Izkata

    As someone who started with tabs and quickly switched to spaces ~15 years ago, I think it’s something much more trivial that’s often frowned upon when source control is involved, but that makes certain parts of code far more readable: Using spaces to align similar statements. It’s much harder to do consistently when tabs are involved. I can easily see that extra readability leading to a jump in productivity, though I wouldn’t expect that much.

    • POOL-POG

      this. however, this is the core argument in the “tab v space” holy war, and as such, it won’t convince anyone.

      space argument: this

      tab argument: this is irrelevant, your IDE/text editor can translate these alignment issues transparently. This isn’t 1995 anymore.

      I’m in the “spaces” camp, btw

      • Pluckerpluck

        > your IDE/text editor can translate these alignment issues transparently.

        Spaces always require you to use multiple arrow key presses to move through them. Tabs are a single key press. This isn’t important if you are a vim god I guess though.

        Or when doing work collaboratively, the last thing you want to be doing is changing the indentation size of spaces (causes chaos with alignment cases), yet tabs let you do this visually without affecting anything else.

        Just pointing out that the translation is not quite transparent. There are still differences.

        • CeeBee

          ctrl/cmd+arrow makes short work of travelling through any indentation or even white space, regardless of type (though I personally find Mac deals with this in a terrible fashion).

          • Izkata

            And vim uses w (for “word”) and b (for “back”) to do the same – jump a text word and its trailing whitespace at the same time in a single keystroke.

        • POOL-POG

          this is why i always use spaces

      • Izkata

        I’m not talking about the beginning of the line, though. I’m talking about in the middle of the lines. For example, aligning assignments or dictionaries into columns, or a related-but-not-abstractable series of function calls or math statements, to make it far easier to just scan down.

        If people could easily stick to Pluckerpluck’s tabs-for-indentation/spaces-for-alignment way of doing it there wouldn’t be much of an issue. But inevitably, tab-users will use tabs to do those alignments, and that’s when it quickly gets all out of whack.

        • POOL-POG

          well… idk about “IDEs” but vim can handle this use case

          still, spaces are the only real way to code

        • CeeBee

          I’ve been arguing for Tabs for Indentation, Spaces for Alignment for years, but.. too many people see it as an all-or-nothing approach, probably since not thinking about it means they can concentrate on other details.. or their 3D printer breaking again.

    • Pluckerpluck

      I prefer tabs for a variety of reasons, but there is ONE aspect I dislike which is aligning statements. Normally I would just say that you should use tabs for indentation, spaces for alignment. The problem is that people suck though and screw this up ALL THE TIME. If people just used tabs for indentations and spaces for alignment it would all work, but alas, that’s not the world we live in.

      My solution is to newline the stuff I want to align. Took a while to get used to, but I think it’s optimum:


      if (longComplexThing && otherComplexThing && finalComplexThing) {

      becomes


      if (
      longComplexThing &&
      otherComplexThing &&
      finalComplexThing) {

      Lets me use the glorious tabs but still ensure code compatibility with all the crazy people who can’t follow a set of coding guidelines.

    • CeeBee

      I learned long ago you wouldn’t want to align with tabs, but that doesn’t mean you can’t use tabs for indentation. I suppose in the end making such a distinction is too painful when your IDE doesn’t do it and you can just hammer tab a few times to align instead.

      • Bryan Oakley

        If you use tabs for indentation and spaces for alignment, how do you handle the case where different tab widths break the alignment?

        • CeeBee

          They don’t. When would you align things on different indentation levels? That’s insanity regardless of if you use tabs or spaces. Using Pluckerpluck’s example below: under TISA that would be spaces, not tabs.

  • Sik

    I’d imagine the real predominant factor here is what kind of coding styles prevail where each of those programmers work (since I’d imagine that eventually this would influence what said programmers get accustomed to using, and hence “skewing” the results here). That would also probably show up some other patterns in common rather than spaces vs tabs.

    • This seems like a good hypothesis. To pick on marketing firms and programmers who work for them, I would have to guess these are the low bar jobs from my experience in working in many different organizations in terms of rigor. The enforcement of structure is much more relaxed and code reviews are practically unheard of compared with a software shops that typically pay more. Code shops tend to use spaces over tabs as it tends to work better in command line editors such as vim and then look good on github as well. Try having tabs on github. It sucks.

    • CeeBee

      Thanks for actually paying attention 🙂

  • zer0 0ne

    Tabs are for word processors not IDEs

  • GrandOpener

    Are median salaries in Germany and UK really *half* what they are in the US? Maybe this is something I should already know, but that was the most surprising revelation here to me.

    • Thomas Peeters

      Perhaps related to the differences in income taxation?

    • No, Americans are more likely to lie about how much they earn. Cela explique tout.

      Surveys are notorious for having people answer what they think should be the right answer.

      That means that a bunch of responses will be conditioned on the fact that Richard from ‘Silicon valley’ uses one or the other (I forget which – I’m a Guilfoyle… I do things that matter, so I have no time for trivial nonsense… he said, typing a comment on the internet – in my own defense, it’s 12:30 a.m. here and I am having a glass of wine having almost finished a project report that was due a week ago).

      People with nothing better to do need false dichotomies so that they can pick a side and belong. It’s been that way since the Blues vs Greens in Byzantium, and probably before. Anyone who wants to belong to either side of a pointless dichotomy needs to die in a fire.

      • klmr

        Hm. Gross salaries for developers in the US are vastly higher than in Germany and the UK. Maybe not 2× but from the numbers on starting salaries (!) that I’ve seen, 2× actually isn’t terribly far off.

        Lying about salary might be another factor but it’s minor compared to the actual, real salary difference. Of course this also differs within the US (Bay area …) but even the mean is higher.

      • Brian

        Americans are more likely to lie.. as you sip on kool-aid calling it wine. Irony…

  • commenter

    Maybe the space users have more of a ‘i don’t care if it is theoretically correct, it works’ attitude and therefore more of them have a job in a larger company which pays better?

    • Spacer

      You’re probably a tabber!

      • commenter

        I doubt that you are one 😉

  • Marlon Stevenson

    Maybe people who use spaces are more likely to overreport their earnings, because they also overcompensate on the lack of control in their lives by repeatedly mashing the spacebar.

    • Do you actually think people who use spaces for indentation press the spacebar for every level indentation that they want? Because that’s not the case, you just configure your editor to use spaces for indentation, to convert tabs to spaces. So when I hit Cmd+] or Tab, it inserts or removes 4 spaces. When I go to a newline it inserts the relevant number of spaces.

      • Juank

        then what’s the point of using spaces if you are already pressing the tab key?

        • PEP-8.

          • Sven Slootweg

            Worth noting that PEP-8 was never meant to be used for anything outside the Python standard library. There’s no reason to adhere to it in your own code, and there’s no technical rationale behind [many of] its recommendations.

          • Being consistent with every other Python project is a good enough reason for me. The tooling around it makes compliance very easy.

          • Bryan Oakley

            While I absolutely hate using whitespace rather than curly braces to denote a block of code, it is far, far outweighed by the fact that most python code looks the same since we mostly all share the same set of guidelines.

        • chugly

          1 – You can align text with finer granularity. For instance if I place a line break in a comma delimited list, the editor can align the list vertically with the resolution of a single whitespace, not 2, 4 or 8

          2 – The code looks the same no matter what the local tab size setting is

          • CeeBee

            That makes no sense. Tabs are only meant for indentation; You would use spaces either way for alignment. Tabs for Indentation, Spaces for Alignment.

        • Bryan Oakley

          the point of using spaces is so that the next person who looks at your code sees it the way you intended it to be seen.

      • Bryan Oakley

        I’ve seen one programmer in this discussion who claims that do that. I can’t imagine why.

      • Marlon Stevenson

        Maybe people who use spaces are not developed enough to understand humor.

    • Spacer

      Tabber!!!

  • wurtel

    Perhaps programmers using spaces lie more about their salary.

    • Félix Gagnon-Grenier

      Found the old school tab user 😉

      • CeeBee

        The trend is the opposite. I find it amusing when people say “Who
        still uses tabs?” — Tabs are more flexible and a *proper* understanding
        of them (and TISA) is only starting to emerge.

        • Félix Gagnon-Grenier

          I have yet to find a single “more flexible” thing one can do with tabs that I can’t do with any code reformatting tool…

          • CeeBee

            Not having to commit it. The moment you bring up a code reformatting tool, it doesn’t matter which side you’re on as the whole debate becomes moot: You pick one, and the one wielding the reformatting tool makes it happen. Period.

          • Félix Gagnon-Grenier

            Ahhh…! I believe I just now understood. I never considered the firm “without code reformatting” situation, thus was always confused with all this mess.

            Like… just hit two keys, and your code looks like you want. Indeed, without that, I would have to rethink about this.

            ta!

          • CeeBee

            Indeed, I think this whole mess revolves around not using reformatting tools and not understanding that TISA is an option… but whatever.

      • wurtel

        Certainly 🙂 I know I should be making more money 🙂
        Actually I only use vim for programming, none of this newfangled IDE stuff for me. In vim it’s trivial to :set expandtab which will accept tab as input but replace it with the appropriate amount of spaces. Combined with :set smarttab you don’t notice the difference with real tabs (besides that your source is larger, which in the early days was actually a concern…).

  • Max Savin

    Perhaps programmers who use spaces also participate in satanic rituals

  • I prefer spaces, but naturally one must adapt to the the coding style used in the project, so I am fine (begrudgingly) with tabs, but what really grinds my gears is when both are mixed – this causes such a horrendous mess…

  • Rolnard

    My IDE always offers to convert spaces to tabs… thus CRUELLY KEEPING MY SALARY DEPRESSED!

  • Michael Beskin

    gofmt uses 8-char width tabs for indentation. Are the Golang devs making ~$20k more with spaces not using gofmt?

    • gofmt uses tabs, your editor makes them 8-char width 🙂

      • Michael Beskin

        gofmt even standardizes the width

        . . . of course you are free to change it in your editor to be whatever you want.

        • CeeBee

          Oh, interesting — it even understands TISA. That’s great!

  • The very recent video “The Post JavaScript Apocolypse” on youtube features Douglas Crockford who says “If you can use one and do without the other, discard the other.”. We cannot do without spaces but we can do without tabs. This clear reasoning removes ambiguity and is a good practice to use this thought in code for all types of things that cause arguments but are not important. Its possible the slight nudge in one direction or the other may correlate with the small % of people that actually think this way where as it may only be a preference in the vast majority of cases as it is in mine.

    • Sven Slootweg

      I’m sure it’s a nice-sounding aphorism, but from a language design standpoint that makes *no sense*. With the same reasoning you could eliminate lots of operators and formats from languages, making the remaining operators have more (ambiguous, context-dependent) meanings. This is obviously not a desirable thing.

      It’s no different with spaces vs. tabs — they have different semantic meaning, for different purposes. *Could* you use one to replace the other? Sure, but you’d lose the unambiguous semantic meaning, which is a bad thing.

      • This is not a good example of “unimportant”. We would all do assembly language then by your reasoning.

        • Sven Slootweg

          What are you talking about? This has absolutely nothing to do with “using low-level languages” (which I presume is what you’re referring to), it has to do with unambiguous language design. “Assembly language” doesn’t come into it.

          I feel like you’re trying to have an entirely different discussion, totally unrelated to the point I’m making.

    • Bryan

      You may have just converted me.

    • commenter

      Well we use tabs for something different than spaces, when we use it for indentation. By your argument we would all code with 3 symbols as those are the fewest symbols we would need to program.

      • Taken out of context. Douglas was referring to unimportant arguments about code style. If you take it in that context, your argument seems reaching.

  • Rolnard

    Maybe being extravagant in your use of bytes reflects an attitude of plenty that becomes a self-fulfilling prophecy in life.

    • Félix Gagnon-Grenier

      oh, so that’s what closing the line break html tag was all about…

    • CeeBee

      The attitude of plenty is rampant these days.

  • I’m a 10x spaces engineer. Your codebase is going to have so many more spaces in it when I’m done with it. Certified spaces growth hacker.

  • acommenter

    I think it’s funny that tabs people in the comments are saying “well it’s probably some other variable!”. The other confounding variables are exactly the point. No one actually believes that switching from tabs to spaces will gain you a nice raise. It’s the type of personality (or habits, or whatever) that lends itself to spaces that is more rewarded.

    • chugly

      That is exactly what I suspect

  • Petar Donchev

    Some languages have universal convention for one or the other – for example Python for spaces and Go code for tabs. So Python programmers definitely earn more than Go programmers?

    • but go you just use fmt…. who cares what you write go will fix it

    • Except the last graph shows that for both Python and Go developers, spacers earn about 33% more than tabbers.

  • carrie

    I find this to be both hilarious and insightful. Thanks for sharing.

  • Benjamin H

    Yeah, developers who use space over tabs probably do make more money. Because developers who use tabs get the job done faster, and as such, work less hours!

    They are ‘Whitespaces’, a useless character in most languages, and yet you waste eight key strokes on them, when you can do the same with one!

    • Sven Slootweg

      Almost every modern editor supports soft-tabs; that is, by hitting the TAB key, you insert N space characters. “Eight keystrokes” is not realistic.

      • Benjamin H

        Perhaps not eight, but unless N is equal to one, my point still stands.

        • N is equal to one

          • Benjamin H

            Ya, misunderstood!

          • klmr

            No: Sublime Text can obviously insert spaces when you press tab: https://www.sublimetext.com/docs/2/indentation.html

          • Thomas

            Do you honestly think people actually hit the space multiple times? Dude.. Everyone just changes the TAB output to X spaces.

          • Yeah I misunderstood

        • Thomas

          No, it really doesn’t.

        • Sven Slootweg

          N *is* equal to one when using soft-tabs. That’s the whole point…

        • chugly

          I press TAB once, the editor inserts ‘N’ spaces with N being the number of spaces needed to make the result visually the same as a hard tab. Try to grasp this concept, apparently it will make you earn more money if you do.

    • Giorgio Polvara

      This is the problem with that “Silicon Valley” episode. Nobody is hitting the spacebar eight times, people just use tab but render it as spaces

      • ive worked with developers who use space manually… it … is horrible

        • Giorgio Polvara

          I don’t see why anyone would do that

          • CeeBee

            Neither did I until I saw Tyler’s answer above. I didn’t imagine anyone would have to sub-condition themselves to handle the situation…

    • Tyler Hibbard

      People indenting by 8 characters instead of 4 are the real problem here, let’s be honest.

    • Mike Barlow

      Try saying “Whitespaces” is a “useless character” when coding in Whitespace – https://en.wikipedia.org/wiki/Whitespace_(programming_language)

      • Bryan Oakley

        or python.

    • Bryan Oakley

      Nobody wastes eight keystrokes for indentation. Us space users use the tab key just like you guys. Every decent code editor will do the right thing and insert the appropriate amount of spaces and/or tabs.

  • Victoria

    How are those using linebreaks :)?

  • xjlin0

    I’d love to see some error bars on your bar graph. 🙂

    • Ryan Thompson

      With 12,000 respondents, the error bars are likely too small to be visible on this scale.

  • Edwin Ramirez

    I’ve always been confused about something: What happens when I set my editor to output tabs as spaces?
    I’ve been using Sublime for years, recently jumped to Atom and VS Code; but in all I always configure my tabs to be 2 spaces.
    On what side am I? I prefer spaces for indentation. It’s more readable, less “empty space” on my screen. But I’m not a fan of smashing my space bar 2 – 6 times for each line.

    • Thomas

      You’re basically using spaces. If I change the keyboard letter A to output Z it doesn’t mean I’m using A.

    • Alfonso Pérez

      That’s spaces, I don’t think a lot of people do what you say ‘smash the keyboard repeated times’

    • Inquisitor

      I think everyone does exactly that. I don’t know anyone that puts spaces in manually.

    • Tyler Hibbard

      The only logical answer is that you are in the tabs group, because you are pressing the tab key to indent. Perhaps the survey’s next iteration should specify to respondents that “spaces” means “pressing the spacebar X number of times”, and we’ll see if this correlation stands.

      • klmr

        I’m pretty sure no professional programmer presses “space” repeatedly. The survey was asking after the textual representation, not the key you’re pressing.

        • Tyler Hibbard

          Hi, professional programmer here. Who presses space repeatedly.

          • Félix Gagnon-Grenier

            You may want to revisit that 😉

      • Bryan Oakley

        “The only logical answer is that you are in the tabs group” – I completely disagree. The debate isn’t about what key you press to do indentation, it’s about what characters are in your source code.

        • Félix Gagnon-Grenier

          finally… the only thing more baffling than tab users thinking space users mash the space key repeatedly, is tab users thinking tab is actually about the tab key, and not the tab character.

    • Bryan Oakley

      If your source code has tabs in it, you’re a “tabs user”. If you use the tab _key_ but have spaces in your source code, you are a “space user”.

      The debate isn’t about which key you press to do indentation, it’s about what characters are actually in your source code.

  • always use spaces

  • caitlynmayers

    I’ve configured my IDE to allow the tab key to use spaces. Prefer tab key for efficiency, but understand the spaces necessity. Does this data account for the ability to use the tab key to execute spaces? How would you categorize this group?

    We got into a heavy debate about this at work, to the point where I made team tabs and spaces shirts. Tabs has been printed twice, Spaces none, if that’s any indication.

    https://cottonbureau.com/products/team-tabs
    https://cottonbureau.com/products/team-spaces

    • Jan

      I imagine most developers in the “spaces” camp do this. I know nobody who favours hitting the space bar multiple times over hitting tab once. But this would certainly be an interesting hypothesis!

      • Tyler Hibbard

        I am a dev who actually hits the spacebar 4 times (if my IDE doesn’t automatically indent for me when I hit enter to go to a new line). I avoid using tabs because it’s not much of a time saver and specifically because we are conditioned to expect “tab” to be “move to the next UI button/element/file” in any other computer context. I’d rather not have to hammer a sub-condition into my mind for “different tab behavior but only in this one IDE”.

        • Bryan Oakley

          Why? Every modern IDE can be configured for the tab key to enter the proper number of spaces. I can’t imagine having (or choosing…) to type four spaces every time I wanted to indent something. Dude, get a better editor!

          • CeeBee

            His point is (if I understand correctly) that way the behaviour will be consistent even if, for whatever reason, he has to use an editor that doesn’t understand this — or even, I suppose, if you’re typing code in a text box on a web page where tab instead causes the focus to go to the next field..

        • Tim!

          Except word processing and document layout, where we expect tab to be “move to the next tab stop/indentation level”. The tab=”indent” convention is both older and more widely known than tab=”next control”.

  • DeeSnood

    I’m a tabs person, mostly because it’s simply the right choice. Firstly, the file size will be smaller. That has to be the preferred choice. Who would choose to have their files be larger? Secondly, it gives you total flexibility in terms of choosing how big a tab is in your editor. If you’re weird and prefer a tab to indent by 8, then that’s your choice. Those who have incredibly nested logic can use 1 or 2 characters. Personally I always choose 4. The thing is, you choose how you want to see it. If the file is using spaces, you don’t get any choice. The indentation will look the same always. If you want to ensure that people always see it the same, you simply specify in your coding standards that people should always set their indentation level in their editor to 4. I’d love to hear any real advantages to using spaces, other than the salary increase 😉

    • Tyler Hibbard

      “I’d love to hear any real advantages to using spaces other than the advantage this entire blog post is about” 😉 Also good look specifying *your* coding standards to dictate that *other people* change their own settings to match your preference.

      • jyounker

        The advantage of a tab is that it allows you to choose your visible indent size. However, varying indent size makes it functionally impossible to enforce column width. Therefore if you have a coding standard with a fixed width, spaces are the appropriate choice for justification.

        • CeeBee

          Why would you need to enforce a column width though? Alignment after indentation? If that’s the case then I guess the real reason there’s such a war over this is people don’t understand TISA.

      • Mike Barlow

        ummm it’s real easy to “dictate” that *other people* change their own settings to match your preference. It’s called using a static code analysis in your build process (I have our lint checker to check and error out if spaces are used in any code).
        You want to use spaces in your code? Great, but your code won’t pass the build queue if you do *wink*

        • Tyler Hibbard

          This assumes that you’re the person in charge of setting and enforcing coding standards for your group, and also that you’re only talking about code environments where code is shared within a small group, which are two pretty big assumptions. It’s also a pretty douche thing to do if you block spaced code.

          • Mike Barlow

            Well wouldn’t it also be a pretty douche thing to do to block tabs? And aren’t coding standards supposed to enforce a consistent style (see: https://www.smashingmagazine.com/2012/10/why-coding-style-matters/)?

            I prefer tabs (that’s just my world, but I can work with spaces if needed). But what happens when I’m walking through someone else’s code and they use spaces, but for some reason didn’t always use a 4 space indent. Their code could look messy and take longer to walk through. Or worse yet, consider the developer who doesn’t use indentation at ALL and try to walk through their code to figure out what’s going on (I’ve personally come across both style of coders, my boss falls into the latter group).
            Code Standards and Coding Style DOES matter, even if it’s only you working on the code.
            … stepping off my soapbox now

      • Bryan Oakley

        The main advantage as I see it is that everyone on a project seems the same code. While it should be avoided, we sometimes like to line stuff up in columns, or align multiple lines of code or data so that it’s easy to read. These alignments simply don’t survive varying tab widths. Combined with the fact that you can’t see tabs, so “foobar” may appear as “foo bar” or “foo bar”.

        Perhaps the real debate is simply between people that see that as a problem, and people that don’t.

    • ever heard of minification? It uses the same principle as the one you’re arguing for, which is who would want a bigger file size 🙂
      Got my tab key to insert 2 spaces on vim

    • Ole Laursen

      No worries, one day you’ll understand why spaces work better when you’re working with other people, and then you’ll switch and be a better colleague, and ultimately earn more.

      If you want to speed up the process, read jwz’ rant. I don’t think reading it is enough, though, it’s a really deep issue.

      I still see indentation issues from time to time in other code, and every single time it’s caused by someone using tabs. Sometimes a previous version of myself.

      • commenter

        Well, for me the ultimate solution to the problem is `go fmt`. It solves the multi-programer problem without sacrificing any principles. I wish more programming languages would supply such tools (code formatting normalization).

      • CeeBee

        It seems to be more a case of “waaah this breaks my software” more than anything. TISA is the best solution.

      • Hernan Silva

        I sincerely would like to know how spaces are better for working in a team, I’ve seen this as an argument several times but I can’t find why… I mean, how is it that you would not mess up with spaces and would with tabs? If all developers on your team are using tabs, how would spaces benefit the team or its members?

        • Bryan Oakley

          The main reason is that you quite often can’t see tabs. If you type “foobarbaz”, it may appear as “foobar baz” or “foobar baz” or something in-between, depending on your tab setting. Thus, it can be impossible to distinguish between words separated with a tab and words separated with a single space. Though, I acknowledge that some modern editors will display a symbol for a tab, which solves that problem.

          There’s also the problem that, as programmers, we sometimes like to line stuff up. Due to the nature of code, lining things up with one tab setting may look awful in any other tab setting, thus making the code harder to read for some, easier for others. You can make the argument you should never attempt to neatly line up code, but there are sometimes good reasons to do so.

          Can you work around all these issues with tabs, or simply live with these edge cases? Yeah, probably. The argument for spaces is that these become non-problems that don’t need to be worked around. It’s One Less Thing to worry about.

          • Most people I know who use tabs only use them at the beginning of the line. This allows a semantic “one level of indentation” that the reader can control how large it displays.

            I don’t recommend using tabs to align things, because then you are correct, it won’t work depending on the tab size. (TBH I don’t recommend aligning things at all but that’s an entirely different story)

          • Tim!

            Yes. The correct answer is tabs for indentation, spaces for alignment, and alignment is generally to be discouraged.

            The problem with spaces for indentation has exactly the same foundation as people are complaining about for tab width: one developer wants to use 2 spaces per indent level, the next wants to use 4. With spaces this problem is worse than with tabs because you can’t correct for it properly with local settings. You end up with the first indent (from dev A’s revision #1) at column 2 and the second indent (from dev B’s revision #2) at column 6.

        • Ole Laursen

          We can certainly agree that if everyone always uses tabs consistently and everyone always uses the same editor configured in the same way, then tabs will work fine, and even allow people to use different indentation widths.

          Now, the problem is that those two requirements don’t hold in practice E.g. you need to look at code made by others, and those other people need to edit your code. Once you have a mixture of tabs and spaces, the code will start looking weird for someone, not necessarily you.

          My favourite example is when you look at code written by tab fans who configure their tab width to say 4 spaces. It is often the case that the code isn’t actually consistentely formatted with tabs, so with a default 8 space tab that most editors will use (or view source in the browser for that matter), it looks garbled.

          I’m afraid it’s a real and annoying problem. I used to use tabs myself.

          I’m aware you probably won’t believe me until you’ve experienced it yourself.

          • CeeBee

            So your argument isn’t about spaces nor tabs, it’s about giving up and using spaces because then you don’t need to worry about it. I mean really, that argument could be applied anywhere where there is any sort of debate on how or what to use — package managers, specific packages, etc. … but you can standardize either way, and need to make sure people follow the standard, otherwise you’ll experience breakage no matter which debate it is.
            Or am I missing something?
            To be clear, I *have* experienced this, and not just in the tabs VS spaces scenario.

          • Ole Laursen

            I’m sorry if my opening comment offended you, I was trying to be joking, but I apologize if it came across condescending.

            Now, to your question: The thing is, if everyone uses only spaces or only spaces and 8-space tabs, it mostly works everywhere because all editors and viewers understand spaces (well, HTML interpreters ignore them unless in pre tag, but…) and many viewers also handle 8-space tabs okayish.

            Now someone figured out that you can use tabs as a sort of system, just like when tabulating data. The benefit is it enables people to configure their favourite tab width. And some people do that, and THEN we have the problem because suddenly we have non-standard tabs so the file is going to look different to everyone else than the author and people with editors configured like the author. Worse, the code can end up being inconsistent, unnoticed, and then it can garble up completely for other people. The only way to fight that is to start being careful about the tabs.

            And right there is the point where the slight benefit of tabs just isn’t worth it compared to the downsides.

            You seem to think that you can standardize everyone to use tabs. You can’t. And as long as you can’t, you can’t have custom tab widths without causing trouble for other people, and if you’re going to use 8-space tabs, there really isn’t any benefit at all if you’re using an editor more advanced than notepad. And there are still downsides. My life was simpler when I decided jwz was right and I made my editor not insert 8-space tabs, navigation became much more intuitive.

            Now this is an argument, mostly against inserting non-standard spacing in text that other people may have to look at. 🙂 I don’t think my previous comment was an argument, really, I was just explaining what I’ve come to see.

          • CeeBee

            The fact that people don’t have the same indentation is irrelevant though, unless you’re using tabs *everywhere* on a line rather than sticking to Tabs for Indentation, Spaces for Alignment (TISA) which seems to be a distinction people would rather just throw out and simplify.

            Certainly, though, no matter where you stand on it if you’ve got people mixing it up, which you probably always will unless you employ what I’ve stated elsewhere makes the whole debate moot, it’s going to make a mess either way.

          • CeeBee

            Anyway, yeah, I wasn’t sure how much of that was you just being crude or joking, so..
            Unfortunately people don’t make much of an effort to make that clear either. 😉

    • Papito

      Larger file size? REALLY? Is that what keeps you up at night?

    • Edwin

      until you work in a language in which indentation matters and you work as part of a team.

      For example, in yaml, you have to use spaces because people with 8 space tabs could be confused with those who use 2 tabs with 4 spaces each.

      If you colleagues use 2, 4, or 8 space tabs code will not be aligned for everybody. Only using spaces guarantees it. Readability trumps trying to save bytes.

      • This isn’t true. You use tabs at the start of the line and everyone can use whatever tab size they prefer. That’s the whole point of tabs! They are useful to mean “one level of indentation” and every reader can decide how big they prefer one level of indentation to be.

      • “Readability trumps trying to save bytes.”

        Especially with the ever-widening gap between how few bytes code requires vs how much bandwidth and storage is available.

      • TennSeven

        Uh, no. If you use the tab *key* and it actually inserts 2, 4, or 8 space *characters* into the code, then you do’t really use tabs, you use spaces. However, if I use actual tab *characters* it doesn’t matter if my editor spaces tabbed content at 2, 4, or 8 spaces, when someone else on the team opens it, his or her editor will show it with his or her preferred amount of space. This is the beauty of tabs. I might like my code super-indented and so my tabs look huge, but someone else might prefer really small indents to take up less horizontal space, and that’s what he or she sees.

        Additionally, if someone else prefers spaces, he or she can just tell the editor “change every tab to X spaces” (X being whatever number of spaces he or she prefers) whereas if I use 4 spaces and someone else gets my code and prefers 2, they have to first figure out how many spaces I use for each level, and then run some kind of replace to get things to look how they want it, which is more of a pain.

  • Pax

    You didn’t account for age of developer. Age is likely to track with salary. The reason spaces are encouraged when training coders has to do with printing on paper. So older developers will have a different habit then newer developers.

    • Tyler Hibbard

      Readability concerns are valid on screen just as much as on print. I don’t think that is a factor, though age tracking with salary should be accounted for.

    • jdkolassa

      Interesting hypothesis. I wonder about age correlating with printing on paper; I’m in my twenties but I will sometimes print out code on a piece of paper to examine, just to get away from the monitor and jostle my brain into focusing more on it.

    • Tim McClarren

      That is not why.

    • Bryan Oakley

      I’ve been a developer since the 80’s. Never once did I think about the ramifications of printing when thinking about spaces or tabs.

    • David Robinson

      We accounted for years of experience, in both the regression and the first chart.

      • CeeBee

        But not age of developer. There’s a distinction.

        • David Robinson

          We didn’t ask about age in the 2017 survey, but we did in the 2015 survey (as well as asking about tabs/spaces and salary), and the effect on salary is the same. Data here: https://insights.stackoverflow.com/survey

          Nor can one find a tendency where developers with the same years of experience that used tabs tended to be younger

          • CeeBee

            Good to know, thanks.

    • The thing that’s difficult about this explanation is that level of experience tracks pretty consistently.

      In general, older employees do have a higher salary floor. However, developers with the same level of experience most likely trained for it around the same time, so they very likely learned the same habits. A 35-year-old with 5 years of experience probably started learning around the same time that a 25-year-old with the same experience did, so they’re more likely to learn the same kinds of habits. I mean it’s possible that some people set aside their development careers for a decade, but I doubt that is a large enough population to explain the results.

      If age was a primary factor in the pay gap, I would expect that at the very least, the older languages would stand out in the regression chart.

  • iusenotabsorspacesanywhere

    • minus Seven

      you
      should
      use
      new
      line
      instead
      its
      amazing
      .
      Writing
      this
      comment
      made
      me
      hate
      myself
      .

      • Kyle Strand

        I had a coworker who did essentially this. He also had incredibly long (sometimes 80+ characters!!) names for everything (classes, methods, variables….)

        Here’s a made-up example (C++):

        ProcConnectionHandle
        ProductNameInstrumentSystem
        ::createNewProcConnection_maybe_fromProcConnectionPool(
        ProcConnectionPool& proc_connection_pool,
        ProcConnectionStatus proc_connection_status_initial,
        MyReadWriteMutexLock my_read_write_mutex_lock_for_proc_connection_pool,
        ProcConnectionId proc_connection_id,
        ProcConnectionAddressIpv4 proc_connection_address_ipv4,
        ProcConnectionPortNumber proc_connection_port_number)
        {
        ……

  • Tony Adams

    I just switched to spaces. Maybe I should ask for a raise.

  • Lincoln

    spaces 4 lyfe

  • Frank

    I hate 17.5% of pro programmers

    • You can set your editor to automatically translate all tabs to spaces. You’ll be able to love programmers again, since you won’t even notice the ones using tabs—unless they tell you.

      • Václav Haisman

        Sure he will notice. He will likely set his editor to expand tabs to wrong number of spaces, given how many possibilities there are, and all the code will look fugly.

  • Félix Gagnon-Grenier

    I’m amazed that so many tab users believe space users press the space key for indentation… Like really? this is so uninsightful I’m almost convinced space users really make more money…

    • CeeBee

      We don’t. Check the other responses to see some space users *actually do* that.

      • Félix Gagnon-Grenier

        no, they don’t, except in a tv show.

        • CeeBee

          I’d like to think people don’t hammer the space bar, too, but there quite seriously are people who admitted to it right here in the comments; Don’t take my word for it.

          • Paul Ishak

            Tabs cause problems when reusing code, thats why i use the 4 spaces setting in notepad++ that replaces tabs as thier pressed. best of both worlds, press tab key to get 4 spaces per press.

          • CeeBee

            How? Spaces cause problems when reusing code, . . . same argument can be applied if what you’re talking about is mixing them; Is that what you mean? Really, a good IDE will change spacestabs as applicable, and if that’s not what you mean I’d need a clarification.

          • Paul Ishak

            Another thing is the size of tabs aren’t always consistant with dofferent fonts… a tab is really just four spaces when typed on paper… personally, for me, a programmer of over 40 years, tabs have always been ugly when coding. not to mention when you start using different character sets. igh it can be a real nightmare…

          • CeeBee

            That’s a terrible argument considering the point is for them to be variable in size, but then again code editors were never made to properly understand tabs. Besides, spaces are generally much more variable than tabs in different fonts, I mean considering you get the whole fixed versus variable width fonts into the argument . . .

            AFAIK #9 is #9 regardless of the character set, care to enlighten me on that one?

          • Paul Ishak

            No i’ll just wait until you’ve gained enough experience to encounter some of the issues that are known to space users, and if you never do then good for you!

          • I like how you gained at least 6 years of experience in 18 minutes lol “my 34 years” “for me, a programmer of over 40 years”

            I mean I agree with you, copy and paste of code (provided you wrote it, trust its author, or at least read it thoroughly) is a pretty normal thing to do. But still, maybe pick a year?

          • Paul Ishak

            that was a typo lol im on my cell phone. good catch though!

          • commenter

            Btw. when you reuse code by copy and pasting you are doing something wrong.

          • Paul Ishak

            What makes you think copying and pasting is wrong? I think it’s funny that as a professional programmer you would ever even say that. Aparrently you’ve never had a colleague email you a snippet, or reused code from other livraries where you only needed one function, or copied code from a template into a new file. I guess its your ___ years of experience as a programmer vs my 34 years.

          • commenter

            Well, that statement was not meant to insult you. It is just that I can still remember my first programing professor telling us ‘everytime you copy and paste code you are doing something wrong’ and over the years there are few statements which I found so true. Yes, sometimes we have boilerplate code which we copy as a template, like a default HTML file. But everytime you copy code you risk that you have to fix a bug in that code in two places at a later time.

            So I found that advice very helpful.

          • Paul Ishak

            Understandable, but I’m not here for programming 101… to insinuate that anyone who would copy and paste code under any circumstance is doing something wrong… is a bit misrepresenting of your own reasoning ability…

          • Joshua Lamusga

            I copy and paste code all day along. It saves me hours of time. The alternatives are (A) spend way too much time reinventing the wheel, or (B) pointlessly retype it all out the exact same. Copy -> paste -> review. Every time.

          • commenter

            How about using libraries? Or inheritance when you are using an OO language?

          • Joshua Lamusga

            Then you acknowledge that copy-pasting the code won’t work if you don’t have the library and can’t reference/include it. If you’re inheriting from a non-existent class and can’t make use of a similar class in your code, you shouldn’t copy-paste. With great power comes great responsibility, or something like that.

          • commenter

            Well, I am not sure if you get my point. I am not against code reuse. I say code reuse is great (because it saves a lot of time). I am against duplicating code. So if the code you need exists in a library, use that library. But please do not copy the code from the library, but instead load the library, so that you can easily update it if there comes a better version at a later time.

          • Paul Ishak

            Especially when your clients pay over $100 an hour… You don’t get the luxury of proving you’re a coding ace… Unless you don’t really care about your clients time and trust, and your ego means more to tou. I say copy and paste as much as humanly possible…

          • Mario Rivera

            Nothing wrong with reusing code by copy pasting.

          • Félix Gagnon-Grenier

            You’re right, it appears a few confused poor sods do it! However, it’s *far* from the majority, and my point that most people that think otherwise are misguided stands.

            Likewise, don’t take my word for it.

          • CeeBee

            That’s also my point, though 🙂 There are *some* people who hammer the space bar, and there are *some* people who think that’s the alternative to using tabs, but that’s far from the majority — on either side.
            I think we are both agreeing on that.

      • Paul Ishak

        Another thingI want to say for notepad++ users is heaven forbid you recieve a file from a colleague who uses tabs when everyone else in the office uses spaces… God that is always a pain in the ass… Same goes for programmers who leave encoding on ascii, but have utf8 characters in their code… definitly annoying.

        • CeeBee

          …and vice versa, so y’know.. we technically agree on that.
          As for encoding, yeah, that’s definitely an issue.

    • Bones Justice

      Oh my, can you imagine? I strongly prefer spaces, but I would rather use tabs than listen to colleagues whack away at their space bars all day. Hell, I’d rather use no indentation at all.

  • I used tabs but configured my editor to put 4 spaces…

    • Bryan Oakley

      So, you don’t use tabs. You use the tab _key_, but you don’t use tabs.

      • Chris G.

        We just figured it out!!!!

        People who respond Spaces are those who were smart enough to realize that ‘Tabs’ doesn’t mean “I use the tab key” but rather “I use the tab character”.

        ‘Tab’ users is ‘Uses Tab Character’ + ‘Uses Tab Key but Space Character, but doesn’t understand the distinction’. My theory is that ‘Uses Tab Character’ has roughly the same salary as ‘Uses Space Character’ but ‘Uses Tab Key and Space Character, but doesn’t understand the distinction’ makes substantially less as to drag down the average.

  • Frank

    Using Notepad++, I don’t have to trade tabs for spaces in order to save space. I can setup my tabulations to appear like 2 spaces without having it to be two spaces, which would be 2 characters instead of just one, making all my files larger.

    • Bryan Oakley

      If you’re optimizing for source code file size, you’re doing something wrong.

    • Not Projecting

      That applies to almost any IDE for the past 40 years. It’s not a debate about which key you indent with, it’s about which ASCII character.

      • RadthorDax

        Or indeed *how many* ASCII characters.

  • Alex Artushin

    Kind of an interesting situation with Go. From the graph it looks like a dev who uses spaces has a median salary in the 70’s while a dev who uses tabs is in the 50’s. However, any Go developer worth their salt is going to use `go fmt` to reformat their code on save, which will switch to tabs automatically.

  • commenter

    I took a quick look at the data (30 minutes) and found the following insights regarding Tabs vs. Spaces:

    When you split the group into younger and older programmers (not by age but by experience), into the ones with up to 10 years experience (Group A: 37905) and the ones with more than 10 years (Group B: 25308) you can see the following:

    In Group A (up to 10 years experience)
    Space Users: 26%
    Tab Users: 33%

    In Group B (more than 10 years experience)
    Space Users: 36%
    Tab Users: 31%

    As Programmers with up to ten years are not only novice programmers, but the ones with a more modern education, this leads me to the conclusion, that it is the result of a modern programming style which favors tabs. Btw. over the whole data set there are alreadey more tab users (16682=32,5%) than spaces users (14666=28,5%).

    So my conclusion is that space users probably earn more money as they have more experience, but the trend shows that the new generation tends to favor tabs and that there is already a majority of users who use tabs.

    • Kostya Pogromskiy

      This assumption is controversial to the first chart.

      • commenter

        How? Please explain.

        • Kostya Pogromskiy

          You say that space users earn more money as they have more experience, but the chart shows that developers with the same experience makes different amount of money depending on their tabs|spaces preferences.

          • commenter

            You are correct, my conclusion is wrong as I did not mean that they earn more money right now, but that they will earn more money in the future as there will be more tab users with more experience and right now the majority of tab users has less experience. So my hypothesis is that tab users will not switch their style when they gain experience but that they will stick with their style and that their group will mature over time and make more money by then. I will correct that.

    • Noel Hibbard

      I have about 9 years of coding and I am a tabber. My father has been coding for almost 40 years and he is a spacer. You hear him all day… bang bang bang bang on the space bar. I put my money on your hypothesis.

    • I think you might be onto something with the age thing – a 30-year-old junior developer would probably make more than a 20-year-old in the same position due to several factors (better negotiating skills, more ‘real world’ time, that sort of thing).

      Though on the other hand, the number of older developers who learned during space days and set it aside until now is probably pretty low, so maybe that’s not the deciding factor…

  • Mark Lapasa

    I tried using Spaces once, it was awful

    • Marios Santamaria

      my salary kept increasing beyond control, I eventually had to go back to tabs

  • TheBox193
    • RagnarDanneskjöld

      I scrolled down to post this same xkcd : ))

    • Mike

      You didn’t read the article did you? I will help you out:

      “Correlation is not causation, and we can never be sure that we’ve controlled for all the confounding factors present in a dataset. If you’re a data scientist, statistician, or analyst, I encourage you to download download the raw survey data and examine it for yourself.”

  • camainc

    I’m a 32nd Degree Master Tabster

  • Lynx

    Spaces is the right answer, no matter what. Most languages are multy-platform. Spaces looks same on any platform and this is not the case for tabs. Just accept it.

    • vim

      spaces gives way to the “how many” discussion, while tabs can be formatted to taste and there is no “how many spaces” discussion.
      computers (parsers, compilers) don’t care, so there is no technical argument.

      = there is no right answer, it is a matter of convention / doctrine

      disclaimer: using spaces but hate having to reformat files (and ruin the git annotation that way) to the point where i think: tabs don’t have this issue.

      • jr1

        lol explain this to my boss who is unapologetically a tabs man.

    • sosiosh

      The whole point of formatting is to make code readable to OTHER humans. Wouldn’t it be nice if there were a technology that adapted to everyone’s personal preference.?

    • TennSeven

      With spaces though you have different developers who use different numbers for each level of indentation. With tabs one tab is always one level of indentation. As for “looking the same,” any person on any platform can make tabs look however they want, or change them to their preferred number of spaces, with a single keypress.

  • Shirish

    ..

  • figital

    The HTML in this clickbait is tabbed with tabs.

    • Mike

      People are over using the word “clickbait”. The title of this blog is in no way shape or form clickbait. Click bait would be:

      “Some programmers make more money that others, read the SHOCKING reason why!!!”

      • Michael Clark

        “Google Developers hate him! Learn how he increased his salary with this one little trick!”

    • They actually mix tabs and spaces.

  • Dave Dyer

    Dude. This is a brilliant study idea, but you should modify your result to only apply to the sampled. This is an observational study, so you can’t claim causation. Visual analysis of confounding variables isn’t enough to claim causation. That being said, you *could* do some random sampling and randomly assign treatment groups if you raise a bunch of babies, randomly indoctrinating them from age 3 to either tabs or spaces, and tracking their salaries over time (with some mechanism to handle serial effects).

    Anyway, yeah, what xkcd said. But still, brilliant idea 🙂

    • Kyle Strand

      The article itself says “Correlation is not causation, and we can never be sure that we’ve controlled for all the confounding factors present in a dataset.”

  • minus Seven

    WHAT KIND OF CIRCLE JERK POST IS THIS…….
    I would have expected better from stackoverflow.
    There is no reason given in the article to explain why.
    Correlation is not equal to Causation.

    • Scott Lavigne

      Did you even read the conclusion?

    • s73v3r

      Yes, they even say that in their post. It’s just an interesting piece of data. They have no idea why it is, it just is.

    • Mike

      You didn’t read the article did you? I will help you out:

      “Correlation is not causation, and we can never be sure that we’ve controlled for all the confounding factors present in a dataset. If you’re a data scientist, statistician, or analyst, I encourage you to download download the raw survey data and examine it for yourself.”

    • It says Correlation is not Causation in the conclusion. This is an interesting and amusing article and that’s all.

  • RadthorDax

    Add a new question on to the survey for next year asking if developers limit character length of their lines to 80 characters. Then see if this correlates with space-use.

  • What of developers who mix tabs and spaces? 😛

    • Kevin Smith

      They are to be exiled to a horrific world where the only language available is PHP and the only editor is ed.

      • jr1

        the only language should be something worse…

        • sheanmassey

          COBOL?

        • Kevin Smith

          If it were worse than PHP, they might give up. PHP is just barely viable enough to entice them to keep going, thus prolonging their suffering.

      • CeeBee

        Or JavaScript.

    • Vrae

      It actually describes people who replied “Both” as being indistinguishable to just tabs.

    • Jimmy

      RTFA

    • Iron Sean

      It’s referenced right there in the very first graph and paragraph. You really didn’t read, did you…

      • It references ‘using’ both tabs and spaces not mixing them. At Cratejoy, we use spaces in Python and tabs for Javascript and Less but we never mix tabs and spaces in a file.

  • jr1

    opinionated and irrelevant. also incorrect findings.

    • mmmpop

      I like think most people reading this would see it the opposite way and as a great example of meaningless correlation between what comes down to stylistic preferences (in most cases).

    • Dave

      What are the correct findings?

    • Kyle Strand

      Also, what’s the “opinion” being presented here? The author is presenting data and even states that the results are “surprising” and unexpected.

  • TechUser2011

    Here is a simple explanation: Younger programmers who are just getting started (say, with less than 5 years of experience) do not know the value of readable code (and thus use the tab character to push code farther to the right than spaces), and they do not know all the bells and whistles of their IDE or text editor, so they don’t know that the tab key can be mapped to add spaces.

    More experienced programmers:
    1. understand the value of compressing more code into horizontal width (for easier reading) AND
    2. read StackoverFlow/Usenet and understand that other experienced programmers use spaces AND
    3. know how to change the settings of their IDE to emit spaces when the tab key is pressed.

    • CeeBee

      Well, 1 doesn’t apply size the whole point of tabs is to be able to adjust them (if you prefer one space indentation, hey, tabs make that real easy and you don’t have to ask anyone to change it too) and 2 is more pedantism than experience. Really, spaces just mean “I gave up and didn’t want to deal with my tools”.

    • That’d all make sense except that first chart shows that space developers make more than tab developers on average even with the exact same amount of time in the career field.

    • rumtscho

      Look at the text again: “I fit a linear regression”. A linear regression coefficient tells you how much of the change in the response variable is due to a given input variable *if we hold all other input variables constant*. The linear regression included both programmer experience and tabs vs spaces, so the effect exists even beyond programming experience.

    • TennSeven

      Your first point doesn’t make any sense. Tabs don’t really make code less readable since you can configure your editor or IDE to represent tabs with any amount of space (or any number of spaces) you wish.

      This also makes tabs more versatile, since it’s more difficult taking code with spaces for indentations and modifying it to look how you want (one tab is always equal to one “level” of indentation, whereas different developers use different numbers of spaces for “levels” of indentation). So while anyone who prefers spaces to tabs can take code with tabs and instantly convert it to spaces, or make the tab distance equal to two (or four, or whatever) spaces for readability with a single keypress, someone who prefers two spaces per indent level will have a harder time making code with four spaces per indent level readable to him or her.

      I’ve been a developer for 25 years and I use tabs, and I know how to change my editors and IDEs to emit spaces when I press the tab key (and also just to set my tab width so I can use less horizontal space without futzing with spaces), so your second and third points don’t really make sense either.

      • TechUser2011

        You missed my point 3, didn’t you? Because you are an experienced programmer, you know how to set your IDE to do these tricks, but an inexperienced programmer does not (or does not value doing so).

        • TennSeven

          No, you missed the part of my reply addressing your point 3, “…I know how to change my editors and IDEs to emit spaces when I press the tab key…”

  • Sagar Tanur

    Tabs are good. I can’t agree with this post

    • Iron Sean

      You can’t agree with Statistical Analysis of a data-set of survey responses? This post didn’t show anything to agree or disagree with, it didn’t say one was better than the other, it showed a result from a collected survey.

    • Kevin Smith

      The article makes no claims about the technical merits of tabs vs spaces. It just points out the existence of a correlation.

  • Jack Johansson

    “The StockExchange of tabbed programmers at wallstreet was dropped by 40 points 5 minutes after this post was published.”

    N.Y.T – 6/15/17

  • elastic tabstops ftw

    • Kyle Strand

      If only, if only, if only….

  • Dennis Hort

    Take THAT Richard Hendriks!

  • sheanmassey

    I used to be a strong tab supporter. I would say “just configure your IDE/editor to show however many spaces you want per tab”. Want 4 spaces, 6, 8 spaces? It’s just an IDE issue. Then I joined teams where the 2 were being mixed all over the place. Now I’m a spaces guy. Because what I see on my screen is what you’ll see on your screen, and vice versa, no matter what. It took me 5 years to realize the importance of this. Spaces > Tabs.

    • Jacob Stamm

      I’m confused. Once you’ve configured your IDE to convert tabs to spaces, that already solves the issue you mentioned. Are you saying you literally press the space bar for indentation?

      • John Reno

        I think he’s saying that as soon as one developer on the team decides to use spaces then everyone is forced to.

        • Nitin

          Forced to explain to that one developer that they’re part of a team?

      • sheanmassey

        Haha, of course not. What I’m saying is the mix of tabs and spaces in code that’s being touched by a team of people, each using their preferred IDE/editor and settings. Some using actual tabs, others using spaces. It get’s annoying fast.

        Personally these are my preferred settings (vim):

        set tabstop=4
        set expandtab
        set softtabstop=4
        set shiftwidth=4

  • Adam Patterson

    My hypothesis: Somebody who touts their use of spaces is more likely to exaggerate their reported income. It sounds pretentious. “I am above using tabs” or “I am better than you”.

  • sheanmassey

    also.. fwiw:

    set tabstop=4
    set expandtab
    set softtabstop=4
    set shiftwidth=4

    End of discussion.

  • So, one who uses space instead of tabs makes more money!!! How is this logical?

    • Klaus Stock

      The coice of programming language influences the decision of spaces vs. tabs.

      • Kyle Strand

        The author adjusted for that.

    • Kyle Strand

      “…this is certainly a surprising result, one that I didn’t expect to find when I started exploring the data.”

      The point of empirical investigation is not “logic” but merely data collection and statistical analysis. The fact that something is true doesn’t make it logical, nor are logically sound ideas necessarily true.

  • Billy Hinners

    Maybe the title of this article should be “Developers who use spaces more likely to exaggerate salary claims”?

  • Potato

    Great! Meanwhile blocker bugs in the SO/SE sites are well and alive! Way to go!

    • One of these days we’ll convince our data scientists to stop looking at data and fix bugs instead. Don’t give up hope!

      • Jerry Coffin

        Perhaps we could, instead, convince SO to hire more/better developers instead of wasting money on data scientists who apparently have little enough useful work to do that they have quite a bit of time to waste?

        And yes, I’m aware that SO have job ads out, so they’re trying to hire developers. Maybe the problem is in the supply chain: too many people being trained as data scientists, and too few as developers (though in fairness, the data scientists I’ve met don’t strike me as people who’d be great developers if they had different training).

        • Félix Gagnon-Grenier

          This argument of “meanwhile, […]” is very unsound. Like, meanwhile, children are dying in africa, stop using your computer and do something about it. If your job is not in health, teaching or food making, you are useless, so you should stop wasting your time.

          kids these days…

      • Nutarama

        You have enough work to justify the salaries of more than one data scientist?

    • Layton Miller

      Mah gawd you guys, who cares? Its a big company, you don’t complain about random studies that Google does, do you? While some studies may seem pointless, one could argue that all minute studies are pointless given no context, yet here we are talking to each other through the internet, having never met in real life, because of what were arguably at the time an enormous quantity of “pointless studies” done throughout history to sufficiently advance technology to the point that we can do exactly this.

      If we put this kind of scrutiny on the SO data scientists, imagine what kind of scrutiny we could put on what YOU do all day, such as…. oh, I don’t know, read the “pointless studies” that you’re complaining about, and then comment on replies of comments, perhaps?

      Hmmmmmmm?
      Hmmmmmmmmmmmmmmm?
      [trollface]

  • One
    of these groups is skilled enough to modify their editor to replace `TAB` with two spaces. The others can’t figure out how to exit vim.

    • Klaus Stock

      Ctrl+Z, pkill -9 vi 😉

      • Craig Allen

        Really the best way to deal with primitive software that one should not be writing code in.

    • Anonymous Coward

      Did you just assume how many spaces I use for tabs?!

    • Tristan Hyams

      4 spaces for Windows devs.

    • “Here’s a nickel kid, get yourself a real whitespace character.”

  • Biggest bullshit I’ve ever read

    • Kyle Strand

      Sounds like you must be a tab user. BURN THE HERETIC!

      • GonzoI

        If you insist, heretic. Stand still.

    • Félix Gagnon-Grenier

      dude… calm down.

    • Marco Ko

      that’s exactly the intention of the author – using the temptative conclusions of an association study to teach sth else. it’s satirical..

  • Marijana Larma

    I suggest the ones using spaces might be largely the ones who believe they are better and have higher standards when negotiating a salary. Which is not necessarily a bad thing.

  • Chris G.

    People who respond ‘Spaces’ are those who were able to differentiate between “I use the tab key” and “I use the tab character”.

    ‘Tabs’ and ‘Both’ users include:
    1. Developers who cannot understand the distinction between ‘Uses Tab Character’ and ‘Uses Tab Key but Space Character’
    2. Developers who cannot extrapolate full solutions from limited information.
    2. Developers who understand the distinction but don’t care about consistency.
    3. Developers who don’t/can’t change the IDE default settings.

    My theory is that ‘Uses Tab Character’ has roughly the same salary as ‘Uses Space Character’ but those who doesn’t understand the distinction make substantially less as to drag down the average for ‘Tabs’ and ‘Both’.

    • Félix Gagnon-Grenier

      Funny, a few days ago, I would have found unbelievable that someone would actually think of tabs as the tab key. Reading the comments here, I am baffled to see that not only do some really don’t see the difference, but these also think space users actually use the space key….

      Amazing.

      • Adam Jorgensen

        I blame that episode of Silicon Valley 🙂

        But in all seriousness, yes, this is a rather mind-bending discovery.

        It also bends my mind that some people fail to understand that the ambiguity inherent in using tab characters is the very reason why space characters are strongly preferred by anyone capable of thinking logically.

        • Stephen Ostermiller

          That ambiguity is a feature of tabs, not a bug. Those of us that like compact code with two space indentation can coexist peacefully with our coworkers that use 4 space tabs. As long as tab characters are in the code it is just a editor setting and both groups can be happy. Even that one weirdo that prefers 8 spaces per tab can do his thing without bothering the rest of us.

          • Adam Jorgensen

            If you genuinely think ambiguity is a feature then I can only conclude you’ve never had to work with timezones and DST transitions 🙂

    • NoSir

      do you even read? medians differ

      • Chris G.

        You’re right. Fixed it from average to median. Though the argument still stands either way. The volume of low salary developers who cannot make the distinction brings down the median.

  • Red Cricket

    Maybe developers that use spaces exaggerate.

    • Paulo Reichert

      You’re probably right as we all know you can’t trust developers that use spaces.

  • Erno

    It’s simple. Programmers get paid per character.

  • Chip Overclock®

    Salary aside, I was a tabber for decades. And it was the predominant coding standard at many of my employers and clients. Then one day my friend and colleague Doug Y. remarked “tabs have to be rendered, spaces do not”. That tiny little piece of wisdom was my Road to Damascus moment. I’ve been a spacer ever since.

    • Luna

      They disappear when its minified.

    • GonzoI

      There is a bit of throwback in it. Tabs are faster to type, and IDE replacement is relatively new. Tabs are also a single character, and code files not having to count bytes is also relatively new. There is a lot of lag between the professional world moving past a paradigm, the educational world adopting that change, and the post-change students getting into the workforce.

      • Guilherme Taffarel Bergamin

        How much relative? I’ve been to a VB6 project where we used the tab key for inserting spaces. VB6 IDE is even smart enough to understand where the level of indentation ends and add only the correct amount of spaces…

        • GonzoI

          30 years. While that’s a lot in technology terms, it’s below the turnaround rate for a lot of major universities. I say this from experience both as a student coming out with 30 year out-of-date habits that I had to get rid of, and having trained several recent grads out of their school-taught habits that were based on green-screen limitations.

  • rmonster

    I think causation is backwards here.

    Programmers that get paid more are more likely to be required to use spaces. I have never worked at a large company with a coding standard that requires tabs over spaces.

    • Guilherme Taffarel Bergamin

      Interestingly, I’ve never worked at a company that stated which pattern we should use, but never seen a professional code where tabs were been historically used instead of spaces. I have used tabs only during the course of my graduation where everything works and looks good. The real world requires you to use spaces.

    • Zapados

      I think you got it!

      Spaces are more likely required when working on a code base that more than one person is working on, since you don’t know how someone’s editor will render tabs (2 characters, 4, 8?). People using tabs work at larger companies and therefore make more money.

  • Robert Boehne

    If one never shares code, or has no concern for the next reader (who may use a different editor) tabs/spaces don’t make much difference. So, developers who know the difference (and care about the NEXT reader of their code) use spaces to preserve their formatting across tabstop changes. I’d argue that developers who care about the next reader are just better at coding.

    • GonzoI

      Most people in office environments work with a mandated IDE, eliminating the tabstop change question. That said, companies that allow diverse environments or working from personal equipment might pay more but require spaces for that reason.

  • This is all self-reported, yes? What if the conclusion is spaces developers are just inflating their salaries by 8.6%? [trollface]

  • Guilherme Taffarel Bergamin

    I think the survey could have been poorly developed. I didn’t have the chance to answer it, so I can’t really be certain of this, but before asking if people use tabs or spaces, you need to clarify that you are talking about the tab character against 2 or 4 space characters in indentation.

    Those in the beginning of their careers might not understand or even know that the IDE can change the tab key output to spaces, which could explain the lower salary. Also, people with longer experience who still don’t get this, might be the kind of people who are not curious enough to enter the IDE configuration and test possibilities. They tend to only do what they are told.

    My theory is that creative people tend to earn more and changing the default configurations could have correlation in this data.

    • GonzoI

      Or they could know what the IDE configuration is, but assume the question is about which key they press. Like you, I didn’t get asked the question, but in the way it’s phrased above I would say “tabs” even though one IDE converts them into spaces and another doesn’t (putting me in “both”). If I were in only the IDE that converts to spaces, I’d be saying “tabs” even though my output was “spaces”.

      • Guilherme Taffarel Bergamin

        Gonzol, if they were asking for which key one presses for identing, my guess is that 90% would reply “tabs” and not 40%.

        Also, there is no technical difference between using the key tab or the key space making it irrelevant for a survey, while there are technical differences between the character tab and the character space such as filesize and indentation of lines of code written in more than one actual text line or languages without a clear indentation pattern like SQL.

        • GonzoI

          Filesize hasn’t really been treated as a factor since the late 90s. The tab/space characters go away when you compile if it’s a compiled language, and they go away when you minify if it’s a transmitted language. The only difference the actual character makes is in display across multiple IDE configurations. And that actually benefits tabs unless someone goes along typing spaces (sort of like someone shoving fixed-width objects in the midst of a variable width HTML page).

          • Guilherme Taffarel Bergamin

            It doesn’t matter if it has only been treated as a factor recently. It is treated as a factor in the present and that is what matters for a survey about the present.

            In any case, neither of us have answered the survey, which means we can’t really know what they meant by “tabs or spaces”. I just think that a lot more people would use the tab key instead of the space key for indentation and not only 40% and that’s why I think that or they were specifically talking about the character or they didn’t make it clear

  • Opslag Medium

    I’d also ask for more money if my boss insisted on spaces. Like I have nothing better to do all day long than correcting code that starts in columns that are not multiples of 4…

    • Guilherme Taffarel Bergamin

      I don’t know which IDE you use, but I’m pretty sure you can use it to autoindent…

    • Chad Hansen

      Most IDEs nowadays will have an automatic document formatter. Configure it properly with your team’s standards and never worry about code styles again.

      • John

        And for those of us not using IDEs – anyone with any technical competence can run a CL linter, autoformater, or bang out our own script in a few minutes to address the issue permanently.

        My point is: No competent dev needs to waste much time dealing with the problem of spaces.

        • Guilherme Taffarel Bergamin

          Just out of curiosity… Why would anybody not use an IDE?

          • Nutarama

            In some languages it’s faster and easier to write your code in a text editor than in an IDE. This is mostly the case for older languages or specialized languages based on old languages that aren’t object oriented. Also an IDE takes much longer to load than a text editor, which means if you’re testing something and can’t keep your IDE open through the testing, you’re going to prefer using a text editor.

          • Guilherme Taffarel Bergamin

            Nutarama, must be a really old language, then. I had this issue in the past. My first professional coding language was FoxPro for DOS. Its IDE was great for building windows in the DOS environment and all, but the actual coding I used to do on Notepad++.

            At that, I used to think of Notepad++ a lot more like an IDE than the actual FoxPro IDE inside DOS…

            If you are refering to this kind of text editor, like the recent VSCode, I would still consider them as IDEs.

          • anonymous

            for starters:
            – Bloated, resource hog, slow execution
            – Overwhelming installation, dependency tree nightmares
            – Inconsistent availability
            – IDE does the wrong thing – interferes with coding
            – Doesn’t integrate with tools correctly (forcing external compile/debug)

  • Jay

    I’d like to suggest initial coding style education as the compounding variable. Teachers who emphasize good coding style are more likely to emphasize the use of particular spacing (and thus passively suggest using spaces instead of tabs) than teachers who do not emphasize good coding style. Students who had the former teachers will generally have better style, apart from space usage, than students who had the latter teachers. Also, students who had the former teachers are more likely to use spaces than students who had the latter teachers. Students with better style (regardless of space usage) will earn higher salaries, so a correlation between space usage and salary will appear.

    Personally, good coding style was a major emphasis in my first computer science (Java) class. We were taught to use four spaces to indent each line. I started off using spaces, but later switched to tabs. If I need to submit code with spaces, I will write the code with tabs and then Replace All tabs with four (or two or however many) space characters (and increase the file size), or configure my IDE to do this automatically. Other than space usage, I am very persistent on style and will fix the style of code I receive before I read or compile it. Because of my positive style habits, I anticipate that I will be in the “Spaces” category of developers as far as salary goes.

    • GonzoI

      Look at hiring habits, though. Very few companies or even startups use code samples from applicant’s own IDE. Most give practical tests or carelessly don’t check code at all. Despite some idealism about style consistency, most employers just don’t care as long as it meets certain readability requirements such as using the right casing and not exceeding a threshold in a calculated cyclomatic complexity.

      You might be right that it is based on the institution, though. Graduates from well recognized universities or those with good placement programs have a better average salary than others, regardless of the quality of the particular program. If we apply this to IT, some particular program in the past could have spread the “spaces” style mistake to well-placed people, resulting in a lot of well-paid coders who don’t know where the tab key is.

    • Guilherme Taffarel Bergamin

      About fixing the style, I used to do that as well, but I had problems with higher ranks because of that, so now I only do it if I’m going to modify a lot that piece of code… Some companies don’t really care about the readability of code. They just want the code to be delivered because the client is waiting for it.

  • Marco Ko

    My hypothesis: The element of tradition in education plays a role, i.e. the confounding factor is by whom the respondent has been implicitly or explicitly taught.

  • Marco Ko

    My hypothesis: The element of tradition in education plays a role, i.e. the confounding factor is by whom the respondent has been implicitly or explicitly taught. Call it genealogy of mentors. This information can’t be extracted from the available survey, thus it can’t be tested at this point. But I predict that you won’t find any other causation in this data regarding the correlation of spaces/tabs vs. salary.

  • Andrew Maxwell

    But how many of those space devs are required to use spaces because of code style guides at their respective companies? Regardless of whether or not they choose to use spaces on their own.

  • Mike Lemmon

    The position of Go in the language graph raises some questions: +$20k/yr for Go devs who use only spaces!? Code in Go is autoformatted with tabs by convention, and a large majority of open-source golang code is autoformatted with tabs this way. Either there’s a big underground community of highly-paid go devs secretly writing their code with spaces, or — way more likely in my opinion — the data is off and go devs who should have answered “Both” said “Spaces” because that’s what they prefer or what they use in other languages where there’s actually a choice to be made.

    • Cory Long

      Or only very few people answered go and spaces, and so the sample size in that specific case is small.

    • Tim!

      I assume language choice was a multi-select option? Might be interesting to correlate # of languages selected rather than treat each individually. I’m thinking maybe space users are more likely to use multiple languages, and multiple language fluency would correlate with higher compensation for multiple reasons.

    • Throstur T

      Go programmers who “use spaces” can still use spaces even if gofmt uses tabs. It’s as easy as a couple of lines in a .vimrc that should probably already be there to begin with.

  • Bill the Lizard

    Clearly employers are paying developers by the byte.

    • Félix Gagnon-Grenier

      Me own bytes go to eleven.

  • Josue Ibarra

    I automated that promotion for those that are interested 😉
    https://gist.github.com/ibarrajo/74a03b135079ee23f3ae0250de11fe4c

  • Mike Darkins

    It’s quite simple, people who use spaces think they’re the best and will happily share their salary etc, whereas Tab users are a lot more modest and rather not share. The 50% of people who didn’t share their income contains all of the higher paid; modest Tab users. And little Space users.

    • Félix Gagnon-Grenier

      … more like, tab users are sour all over the place 😉

      as you may have noticed, the only people resorting to name calling, are name calling the space users.

      Literally none have said stuff like “we’re better”.

  • Matteus Deloge

    Could it just be that the ‘spaces’ method is an older form of code formatting and that older programmers using spaces have the advantage of seniority therefore earning more money? So it’s not that using spaces earns you more money, it’s your seniority that explains a higher salary …

    • David Robinson

      See the first graph; the effect exists within each level of years of experience.

    • Nick

      Dude did you even read the article? Years of experience was literally the FIRST confounding factor that they controlled for.

      • Matteus Deloge

        Totally blew past that, I guess I need to refill my cup of coffee big time. Apologies

        • anonymous

          Years of coding does not necessarily track perfectly with age (e.g. some of the people using spaces could be folks who started coding later in life, or who have spent more years of their career in non-coding positions, especially management), so it could possibly still be a confounding variable

  • mingos

    It’s not the spaces that make you more money. The best paying companies usually mandate that you should use spaces. The whole spaces and earnings thing is one giant fallacy from the ground up, mixing up the cause and the effect.

  • Typing spaces just takes more time, thus per/hour it is more expensive. That simple 😊

    • JadePenguin

      Many editors such as PyCharm do spaces automatically when you hit TAB key

    • Félix Gagnon-Grenier

      …. you really think people use the space key to insert the spaces?

      https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-use-tabs/#comment-3363700432

      • el.dide

        … you really think this was not a joke ?

        • Félix Gagnon-Grenier

          Yes. Read the comments a bit more. Many people are actually making that assumption, very seriously.

          Though, maybe there are some jokes in there, but judging from the general sourness in the comments of tabs users, I don’t find it hard to think 😉

          … and if it were, I’d still argue it is getting really old, having been made like 30 times already…

    • ryepdx

      I don’t think anyone who uses spaces over tabs types the spaces individually. The IDE does it automatically for you.

      • GonzoI

        If you’re filling out a survey on Stackoverflow, and you are asked if you use “spaces” or “tabs”, are you going to answer based on what key you pressed, or on what your IDE did for you? I would answer “tabs” even if my IDE converts them into spaces. You also would see the effect dramatically decrease when controlling for language as some languages don’t have an IDE that does spacing automatically. This is indeed talking about typed spaces.

        • Félix Gagnon-Grenier

          Of course you’d answer based on what the character actually is in your script, that’s the whole point of the debate. Adaptable tab size does not refer to your keyboard!

          Languages don’t “have” ides. Text editors can edit any text in the world, in any language, and you can control indentation of your text editor.

          • GonzoI

            Considering the comments here, the two of us may be demonstrating the divide. It’s not that we “don’t know the difference” as a certain person put it above, it’s that the question is being presented in a way that some of us think you are (like people we know in the workplace) pressing the space key rapidly every time you want to start a new indention level.

            If it were actually about consistency, tab use and tabstop size would be mandated instead of requiring spaces since you can’t type part of a tab. It isn’t about readability because people configure tabstops how they prefer to read indentation. Take away all the flimsy arguments that don’t actually hold up when you think about them and you’re left with only 1 tradeoff: The benefit of consistently using tab characters is that they adapt to the display preferences of the individual programmer. The benefit of space characters is that tab characters adapting to the display preferences of the individual programmer suddenly look weird when one idiot presses the space character a bunch of times instead of using tab. If we didn’t have people who actually pressed the space bar multiple times, we would all be using tab characters.

          • ozzy

            It won’t matter if you’re only looking at code in the same IDE on the same platform.
            If you use diff/merge tools or a platform like Github where the diffs are shown in a browser, the whitespace formatting becomes a huge issue.

            Always convert tabs to spaces, because you can’t set every tool to use the same tab size.

        • ryepdx

          I’m going to answer based on what I configured my IDE to do, which is spaces. I specifically set up my IDE to use spaces. It would be utterly braindead to hit the spacebar multiple times at the beginning of each line.

          Anyway, I use Vim most of the time, rather than language-specific IDEs. There are almost always Vim plugins for whatever language I’m using, and if not I still get my preferred formatting.

          • GonzoI

            Umm… “beginning of each line”? I didn’t think even vim required you to do that. Yes, many people do (you can audibly tell when they do, even with “quiet” keyboards) press the spacebar four times to make an indentation. But any modern IDE only requires you to do it once (or tab once) for each layer of indentation you want.

        • Guilherme Taffarel Bergamin

          Gonzol, that is the reason why I think the survey may have been poorly developed. The whole point between tabs or spaces is the character and not the key pressed. Basically there are these two arguments:

          – Tabs consume less bytes and can be rendered in any size you need your indentation to be
          – Spaces let you have more control over indentation in cases when you need a long line of code to be broken in pieces and maintain a nice and tidy read of the code

          • GonzoI

            I’m confused on the second one how that would differ from tabbing. When I break a line of code for readability, I use the same tab-indention that I do for nesting so that it’s consistent and obvious for the next person who reads it. Having varying lengths of tabbing seems like it would be harder to read.

          • Guilherme Taffarel Bergamin

            Gonzol, not varying lengths of tabbing, but varying number of spaces when you break a long line, for example a long if statement consisted of many “ors” and “ands” with parenthesis and so on, or when you want your String look in the code the way it will appear on the screen when running

          • Ext3h

            [code]char *foo = (
            “In”
            “Don’tn”
            “Seen”
            “Yourn”
            “Problem”
            );[/code]

            If ever something inside a pair of parenthesis needs to be broken into multiple lines, just break everything instead. If you would need to break and there are no parenthesis yet, just add them.

          • Ext3h

            I prefer to use a brace style which does never need alignment on keywords identifiers. So if you need to break an argument list, everything gets on a new line, and then is just indented with tabs, no side effects.

            If the style guide does not permit that, indent with tabs according to the current indentation level, and then use spaces to match the length of the non-tab characters in the previous line.

            Both renders nicely regardless of the configured tab width.

          • GonzoI

            Are you saying to tab/space to match the placement of the brace in the first line? In older styles, I could see that, but now that most are going to names that “self-document”, that’s too deep for tabbing.

            So we’re not talking across each other, my thinking is:

            Employee.Address.CreateNewAddress( city, state, zipcode,
                 streetaddressline1, streetaddressline2)

            If I understood what you were saying about matching the length of non-tab characters in the previous line, you’d run into problems with:

            Employee.Address.CreateNewAddress( city, state, zipcode,
                                                                            streetaddressline1,
                                                                            streetaddressline2)

            EDIT: Forgot that I’m on the internet where spaces aren’t rendered…

          • Ext3h

            If you need to break one, then break all.

            Employee.Address.CreateNewAddress(
            t city, state, zipcode,
            t streetaddressline1,
            t streetaddressline2
            )

            Yes, that is two more lines, but the indentation is unambiguous. Also non of the lines is even remotely approaching the length limit.

            So much for my preferred style.

            For the other option, the additional indentation to match the parenthesis only with spaces. In front of the spaces all the tabs used on the parent line. So effectively:

            ttt Employee.Address.CreateNewAddress( city, state, zipcode,
            ttt ………………………………………………………streetaddressline1,
            ttt ………………………………………………………streetaddressline2)

            That fits the appearance which many of these “manual space artists” try to achieve, while still correctly behaving with different personal preferences on tab width.

        • Nick Brown

          So then the findings are that developers who are familiar enough with their editor to know what is output when they hit the tab key make more than developers who aren’t.

          • GonzoI

            Could you stop with the “them dumb, I smart” garbage? Everyone knows what their editor is outputting. Even if they don’t delve into the IDE configuration, the first time they backspace over a “tab” they learn whether it’s replacing them with spaces or not.

    • BlueNinjaSmurf

      Configure your editor right and there is no extra time. Also, spaces maintain consistent visual styling across development tools.

  • Colz

    You’re missing a variable prob

  • Arnold Spence

    Use an IDE that will display code formatted however you want it and save it formatted according to whatever code style convention is in place. Or use a pre-commit hook to format it. Arguing over tabs vs. spaces seems like a waste of energy.

    • Nikhil Sahu

      Finally someone said it.

  • Ralf Kleberhoff

    Depending on the editor used, tabs get expanded into 4 or 8 spaces (typically). So, tab-indented source code often shows up with unintented indentation – really ugly.
    Maybe, a developer who doesn’t know or care about that fact simply doesn’t achieve the same reputation as another one who knows and cares.

  • Kevin Norris

    > So… this is certainly a surprising result, one that I didn’t expect to find when I started exploring the data.

    I really wanted to be the killjoy who says “you can’t just [play around with your data until you find a result you like][1],” but…

    [1]: https://en.wikipedia.org/wiki/Data_dredging

    > p-value 10^-10, so this is **still a significant result** even under highly pessimistic assumptions. That’s actually very surprising: You did sloppy statistical analysis and still managed to get a “good” result.

    [2]: https://en.wikipedia.org/wiki/Bonferroni_correction

    • David Robinson

      I’m aware of the statistical challenges of multiple hypothesis testing, and I’ve done mathematical research on the topic (check it out in Chapter 5 of my dissertation: http://arks.princeton.edu/ark:/88435/dsp01hd76s238c ). But I just said I hadn’t expected to find this result, not that this wasn’t the first thing I checked.

      As it happens, I was interested in writing a blog post on tabs and spaces, and after first measuring the percentage using tabs/spaces/both the first hypothesis I tested was the salary difference. (Wouldn’t you?)

      • Kevin Norris

        I made pessimistic assumptions in order to demonstrate the robustness of your result, not to criticize it.

  • Baris Ozkuslar

    I think the reason is that many people don’t understand the question. Because many people are just using tabs, and they are not aware of the fact that tabs can be composed from tab characters vs space characters. They will probably think like this: “Of course I use tabs, who would press space repeatedly instead of using tabs”

    So, I split people into four groups:

    1. People who uses tabs, and know about spaces/tabs topic.
    2. People who uses tabs, and don’t know about spaces/tabs topic.
    3. People who uses spaces, and know about spaces/tabs topic.
    4. People who uses spaces, and don’t about spaces/tabs topic.

    I expect groups 1, 2, 4 to answer tabs. Because of not knowledgeable people in group 4, since we can assume not having knowledge about an arbitrary topic statistically decreases the expected wage, tab answer will have a lower average wage.

  • Ritesh Rituraj Nayak

    As @chipoverclock:disqus remarked before me, tabs have to be rendered, spaces do not. The length of a tab varies across platforms – I’ve seen it rendered as 2 spaces, 4 spaces and 8 spaces in my life time. This one time I beautifully formatted code in my IDE with tabs, which were the width of 4 spaces in my system. As soon as I uploaded it on gerrit, its ugliness was pointed out to me and I soon realised that because gerrit was rendering tabs as 8 spaces, none of my secondary indentation had any effect anymore. I’ve since learnt 2 things
    1. Do not use tabs to separate pieces of code horizontally to a specific amount.
    2. Do not spend time making cosmetic changes when the right IDE plugin/package can do it for you on the fly as you type.

    I guess people who have abandoned tabs are the ones who were quicker to realise this than their counterparts in the same experience bracket.

    • Stella Orion

      Will you marry me?

      • Ritesh Rituraj Nayak

        I’d love to!

        • Stella Orion

          Just for the people reading this, he did not just say yes to a random stranger: I am not a troll, I am his girlfriend. XD

  • GonzoI

    As long as we’re coming up with ridiculous theories based on huge, self-serving assumptions, I’ll throw one out too. Maybe it’s that tab users aren’t as worried about minutia and seek a better work-life-balance rather than higher pay.

  • Maxxon

    Ahhh, but did you think that those ppl who use spaces are more likely to lie? 😉 😀

  • Will

    The comments that talk about the “waste” in repeatedly hitting the space key are a clue to the answer. I suspect there’s also a correlation between high pay and developers savvy enough to use a text editor sophisticated enough to require exactly the same number of keystrokes to indent using either tabs or spaces.

  • cb75075

    Its also directly correlating with shark attacks.

  • Axel Heider

    So, now we need this correlated with Vi vs. Emacs…

  • Brett Davis

    WHAT IF PEOPLE WHO USE SPACES ARE PAID BY THE HOUR AND TAKE LONGER TO TYPE STUFF?

    • *meanwhile in normal editor/ide* [tab] -> 2 spaces so doesnt matter. 😀
      Using notepad can take more time.

  • handleym

    “The model estimated that using spaces instead of tabs leads to a 8.6% higher salary”
    This is an exceptionally silly way to present the finding…

    The finding itself is, IMHO, not surprising.

    *Using spaces gives one finer control over exactly how one’s code is laid out and formatted; and people who care about that sort of detail are people who care about other details, and so make better programmers.*

    I suspect you’d find the same sort of correlation if you tested for “number of spelling or grammatical errors per 1000 lines of code” vs salary. (Though that one’s a little tougher to test well because of people programming outside their native language.)

    But the causality doesn’t run the other way. Just switching to spaces (while still not giving a damn about either EXACTLY how your code is laid our or EXACTLY how it behaves) isn’t going to make you a better programmer.

  • Lex Irons

    I prefer spaces over tabs. Most editors convert the Tab to spaces, so developers basically indent pressing the Tab, but that just creates e.g. 4 spaces. No one is bashing the spacebar. So if I was asked what do I use – spaces or Tabs I would be confused, and I guess a lot of people did answer spaces (because the end result is space indented) but they do use tab to do it.

  • Operating Thetan

    Have fun with your Makefiles then.

  • Morgan Grobin

    Wow, I never knew that the whole spaces/tabs debate was simply a misunderstanding between the two groups. As an EE student/hobbyist programmer, I legitimately thought that people who used spaces actually pressed space 4 times to achieve that. Based on these comments, it seems like the tab camp is arguing “Pressing the tab key is easier!” and the space camp is arguing “But spaces make for more consistent formatting (and we also press the tab key!)” Without discussing their underlying assumptions.

    It seems to me that people who continue to press the tab key for efficiency’s sake, but also go out of their way to update their .vimrc or IDE settings to change the tab key to spaces for formatting consistency, are the kinds of people who would take more initiative in projects, be more thorough in their research, and simply have more random knowledge – all traits that would be rewarded with promotion and salary increases.