Skip to content
 

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

Rudy Malka writes:

I think you’ll enjoy this nice piece of pop regression by David Robinson: developers who use spaces make more money than those who use tabs. I’d like to know your opinion about it.

At the above link, Robinson discusses a survey that allows him to compare salaries of software developers who use tabs to those who use spaces. The key graph is above. Robinson found similar results after breaking down the data by country, job title, or computer language used, and it also showed up in a linear regression controlling in a simple way for a bunch of factors.

As Robinson put it in terms reminiscent of our Why Ask Why? paper:

This is certainly a surprising result, one that I didn’t expect to find when I started exploring the data. . . . 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.

Speaking with the benefit of hindsight—that is, seeing Robinson’s results and assuming they are a correct representation of real survey data—it all makes sense to me. Tabs seem so amateurish, I much prefer spaces—2 spaces, not 4, please!!!—so from that perspective it makes sense to me that the kind of programmers who use tabs tend to be programmers with poor taste and thus, on average, of lower quality.

I just want to say one thing. Robinson writes, “Correlation is not causation, and we can never be sure that we’ve controlled for all the confounding factors present in a dataset.” But this isn’t quite the point. Or, to put it another way, I think he has the right instinct here but isn’t quite presenting the issue precisely. To see why, suppose the survey had only 2 questions: How much money do you make? and Do you use spaces or tabs? And suppose we had no other information on the respondents. And, for that matter, suppose there was no nonresponse and that we had a simple random sample of all programmers from some specified set of countries. In that case, we’d know for sure that there are no other confounding factors in the dataset, as the dataset is nothing but those two columns of numbers. But we’d still be able to come up with a zillion potential explanations.

To put it another way, the descriptive comparison is interesting in its own right, and we just should be careful about misusing causal language. Instead of saying, “using spaces instead of tabs leads to an 8.6% higher salary,” we could say, “comparing two otherwise similar programmers, the one who uses spaces has, on average, an 8.6% higher salary than the one who uses tabs.” That’s a bit of a mouthful—but such a mouthful is necessary to accurately describe the comparison that’s being made.

42 Comments

  1. Mike Lawrence says:

    But see this re-analysis: http://evelinag.com/blog/2017/06-20-stackoverflow-tabs-spaces-and-salary/index.html

    The space-users group is bimodal: a larger group that has no salary advantage over tabs and a smaller group that does.

    • zbicyclist says:

      Ever try to clean up some code (or table) where tabs were used? Such a waste of my time!

      A space is a space is a space (in a fixed font, like Courier), but tabs are personal.

      (from the reanalysis)
      ” My theory is that when diverse people are working on open source projects together without enforced coding style, the possible formatting mess is nudging people towards using spaces simply because the code is consistent for everyone.”

    • Andrew says:

      Mike:

      I followed your link, which leads to this conclusion: “Environments where people use Git and contribute to open source are more associated both with higher salaries and spaces, rather than with tabs.” That makes sense, and I think it’s generally consistent with my jocular statement above that “the kind of programmers who use tabs tend to be programmers with poor taste and thus, on average, of lower quality.”

  2. Francesco Varrato says:

    Fun fact: Richard Hendricks, the fictional character of the “Silicon Valley” TV series is fan(atic) of tabs instead of spaces … and I think this is the more trendy piece of pop-culture about the subject :)
    He argues that using tabs instead of spaces improves efficiency while typing, and I do agree: more code in less time. But, as code comes with errors, more code means more errors. Maybe a little slowdown makes room for more reflection.
    Btw, it’s usually possible to configure the editor in order to press tab and make it insert a custom # of spaces instead: the worst of both worlds!

    • Noah Motion says:

      That’s the best of both worlds! Pressing tab means a single button push for two spaces in my vim. I get the efficiency gains of reducing the number of button presses, but my code is morally spaceful.

      That episode of Silicon Valley is very funny (as is the show as a whole). Note that Hendricks also argues that tabs reduce file size, which is important to him, since he’s all about compression.

  3. Thanks for your great comments on my article.

    You’re right that I unintentionally let some causal language sneak in. I’ve made a few edits in consideration: I changed the “leads to” sentence to be “using spaces instead of tabs is associated with an 8.6% higher salary,” which while not as precise as yours at least doesn’t have as dramatic implications as “leads to”. I’ve also extended the confounders text to include “or indeed that the confounders were measured in the survey at all.”

  4. Yes, you make important point about the causal language. Two other thoughts:

    Developers who use spaces rather than tabs may be in salaried positions, so if they take a few extra seconds to exercise good taste when coding, this won’t affect their pay. Those who are paid by the hour, on a freelance basis, may be in a greater rush, especially if they are juggling projects from multiple companies. In that case, it could be the pay that affects the tab/space choice and not vice versa. I don’t know that this is the case, but it seems plausible. Salaries give you some luxury and wiggle room.

    Also, some developers customize their tabs so that they look right. They would constitute a third category: those who both create and use tabs. I wonder how their salaries compare to those of the others.

    • Dzhaughn says:

      Most developers I ever knew use a text editor such that the “Tab” key insert the intelligent number of spaces, so I don’t buy arguments about them being “more careful” or “more deliberate.” They press the same keys in the same order. They wear down the backspace key a bit more, perhaps.

      Having said that, perhaps we are seeing the True Cost of Using vi.

      • phayes says:

        Quite. There’s a similar remark above, but the idea of having to actually insert spaces manually to effect indentation and alignment – given you’ve chosen spaces over tabs – is bizarre.

        • I think the causality goes like this, and I’m being deadly serious this time:

          There are those developers who know a lot about how to develop software, for example Bob Carpenter who works on Stan is very clearly a pro, he has deep knowledge of lots of skills for software development. These people know how to use automated tools to aid them: IDEs, source code control, etc etc etc and you’d expect them to be able to earn more money because their skills are valuable. When these people press the tab key on their keyboard, their software tool figures out how to place the appropriate type and quantity of whitespace so that the code indents in a standard way which works well. They may even have set up an explicit indentation standard, and even have an automatic script that reindents code using the standard before checking it in to their source code control (I’ve seen this before).

          Then there are people who learned C++/Java/Javascript/Ruby/Python/R or whatever out of a couple of books or a single undergrad course or whatever, they haven’t yet accumulated a wide ranging knowledge of the process of software development, and this is correlated with using some editor that when you hit the tab key, it puts a literal tab.

          Of course, then there are people who are more or less along a spectrum.

          But having deep knowledge of an IDE/editor that aids your process of development is also correlated with hitting tab and getting something smart which could well be spaces, or tabs and spaces combined.

          • Bob says:

            Daniel noted:
            ==========
            They may even have set up an explicit indentation standard, and even have an automatic script that reindents code using the standard before checking it in to their source code control (I’ve seen this before).
            ==========

            As the Wikipedia article on Prettyprint recounts, such software has been around for many decades.

            Of course, some of us never struggled over spaces vs tabs, having learned keyboarding on IBM 026 (or 029) devices.

            Bob

          • We pretty much follow Google’s style guide for C++, so no tabs. You can automate tab to space conversion in emacs as well as removing line-ending spaces: https://github.com/stan-dev/stan/wiki/Dev:-Tricks

  5. Jack PQ says:

    Not to sound glib, but this is an obvious omitted variable bias problem of the sort we teach in undergraduate econometrics. And equally obviously, it is not the use ofspaces that increases programmer salary, but omitted variables correlated with using spaces and not tabs. Dog bites man.

    • Andrew says:

      Jack:

      As I wrote in the post, I think the descriptive comparison is valuable in its own right. It’s interesting to learn that developers who use spaces make more money than those who use tabs.

      • Jack PQ says:

        Prof. Gelman:
        Yes, I agree, but the story is only half-told. When we teach undergraduates this stuff, we’d say, Great! You found an interesting link. Now figure out what’s really going on. It’s like a detective finding a body. You don’t stop there. You need to solve the crime.

        • Andrew says:

          Jack:

          Yes, that’s the point of our Why Ask Why paper linked above, and Robinson deserves credit (and Gabasova deserves credit in the followup) for exploring possible explanations.

          • Jack pq says:

            @prof German, @Cliff AB
            Yes I agree it is interesting to report this, but it is bad practice to imply cause and effect. The data are equally supportive of the claim that when a programmer’s salary increases, he or she is more likely to switch to using spaces rather than tabs. That’s the point. That’s why endogeneity and omitted variable bias problems are so tricky.

        • Cliff AB says:

          Jack: I don’t think anyone reads that report and thinks “using spaces will immediately raise my salary”. The author of the article may have casually used causal language, but I don’t think that was intentional. In that light, there’s no bias in this analysis: after linear adjustment of several other factors, developers who use spaces make more on average than those who use tabs. And a non-trivial amount more!

          The point the article is much more that those who use spaces just scored themselves a solid point in the ever persistent “spaces vs tabs” argument; bosses seem to think that on average, their space-using developers are more valuable than their tab-using developers (even though bosses are very unlikely to know this fact, especially at time of hiring!). This gives space-users a bit more authority in the conversation.

          And I say this as someone who often uses tabs in my personal code. However, I try not use tabs on collaborative projects; I vaguely recall that different IDE’s can handle them slightly differently for some reason and this caused a headache on a project that I worked on. On my machine, my code looked very pretty, but opened in a different IDE, it looked like a jumbled mess (don’t quite recall the details of the issue, but I do recall switching to spaces fixed the issue). This observation seems to agree with the follow up analysis about using version control; if tabs occasionally cause problems in sharing code but spaces do not, that seems like a very reasonable explanation for all aspects of both analyses.

          • Anoneuoid says:

            On my machine, my code looked very pretty, but opened in a different IDE, it looked like a jumbled mess (don’t quite recall the details of the issue, but I do recall switching to spaces fixed the issue)

            Yes, I am surprised people don’t immediately switch to spaces after encountering this. First time I noticed that happening to me I converted all my indentations to spaces and that was that. I don’t really see any tradeoff here.

  6. fraac says:

    Because they’re psychopaths.

  7. Mr.Ed. says:

    “Otherwise similar”

    that also sounds like a causal statement to me

    i thought that the (reasonable) point you wanted to make is that these programmers are probably different in many ways, and not only in how they indent their code

    • Andrew says:

      Ed:

      No, “otherwise similar” was not intended to be causal. “Otherwise similar” is shorthand for “having the same values for the other predictors included in the model.”

      And yes, of course these programmers are different in many ways, and not only in how they indent their code.

  8. It’s all down to emacs vs vi

    ;-)

    “using spaces” is associated with using the correct editor… emacs, which knows the language you are programming in and properly formats your code by simply typing a tab key (which inserts the correct number of spaces for the current line).

    “using tabs” is associated with using vi, which no one actually knows how to use because it was designed by rabid weasels.

    let the flames begin!

  9. Peter says:

    Everyone at Google uses spaces (for languages that aren’t Go, anyway), and I believe it’s the same for FB. I feel like if you knew which companies the respondents worked for, this would be less mysterious.

  10. TBW says:

    You can’t look at annual salary #’s, you have too look at rate, people who use tabs are more efficient and thus work fewer hours and end up with a higher pay rate. Sure we could spend copious hours each year typing spaces in order to make a few more bucks, but we lead rich, fulfilling lives and have better things to do.

  11. Jason Yamada-Hanff says:

    Spaces users have just failed to complete the full evolutionary process from tabs -> spaces -> smart tabs (https://www.emacswiki.org/emacs/SmartTabs). tabs for indentation, spaces for alignment.

    it works beautifully and neatly solves this sort of problem: http://andrewgelman.com/2008/01/03/rant_on_r_inden/ or Cliff and Anoneouid’s problem about things getting jumbled. You just set the tab appearance to whatever you want. The downside, of course, is when you are working with other people on a team… thus back to spaces, sigh.

  12. Tyler says:

    “Soft tabs”

    As others have noted, spaces are best practice especially when sharing code. However, instead of hitting the spacebar a bunch of times, most editors have a “soft tabs” feature which adds 2-4 spaces when the tab key is hit. Most teams will use something like EditorConfig and/or linting tools to manage formatting consistency.

  13. Sean Matthews says:

    it’s trivial to go back and forth between tabs and sapces in emacs, so it is not much of an issue for emacs users. I wonder is there any correlation between emacs and salary. I’d be willing to bet that there is quite a substantial one.

  14. Radford Neal says:

    My pure speculation… It’s about typing speed.

    Programmers who don’t know how to type properly are very concerned about minimizing keystrokes, so of course they use tabs – avoid keystrokes at all costs! And even auto-converting tabs to spaces doesn’t really do it for them, since you have to type control/F more times to move through the spaces later on. You might think that you don’t have to be able type very well to quickly hit space or control/F repeatedly, but once the minimizing keystrokes psychology sets in, such details don’t affect behaviour.

    And of course programers who don’t know how to type are generally less productive. Seriously. There’s the obvious time waste. But beyond that, consider a programmer who gets some idea for a better way to do something. Trying it out will require typing in 30 lines of code. Maybe, they think, the old way isn’t so bad…

Leave a Reply