Slashdot Mirror


Developers Who Use Spaces Make More Money Than Those Who Use Tabs (stackoverflow.blog)

An anonymous reader writes: 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. 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.

11 of 515 comments (clear)

  1. Only dummies and newbs argue stupid shit by Anonymous Coward · · Score: 5, Insightful

    Proof: neither side makes jack-shit as a coder

    1. Re:Only dummies and newbs argue stupid shit by avandesande · · Score: 5, Insightful

      actually a smart PHB would force everyone to use tabs and give them a pay cut

      --
      love is just extroverted narcissism
  2. Survey says by StikyPad · · Score: 4, Insightful

    If the median salary was under $50k, then I'm not sure who they were surveying, but it wasn't professional developers.

    1. Re:Survey says by swillden · · Score: 3, Insightful

      Yeah, my hunch is in a true survey of all programmers, it's the tab-users who make more money. Tabs are a relic from the old typewriter days, so older programmers are more likely to use them. And older programs tend to make more money.

      It's the other way around. Old programmers worked on systems where the size of a tab was fixed at 8 spaces and could not be changed. Since 8-space indentation is way too much, they used either a mix of tabs and spaces to get the right indentation level, or spaces only. And then when we all started to get editors with configurable tab sizes, the mixed solution resulted in an unholy mess which was most easily fixed by standardizing on spaces only.

      And old programmers tend to make more money, so money is correlated with spaces-only indentation.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  3. Charming and fun, but not informative by TimothyHollins · · Score: 2, Insightful

    Let's say that using spaces was taught in the 70s, while tabs was taught in the 80s.

    Now let's say we ask people for their style and their income. The older programmers that by now make more money will say they use spaces, while the younger programmers will say tabs. This would account for the differences.

    In short, this survey isn't providing enough data to control for any factor, and the likelihood that tabs and spaces actually impact the earnings of any programmer is 0.

    Also, any programmer that uses spaces is going to Hell (which runs Windows ME on the user machines)

  4. cause vs correlation. by fish_in_the_c · · Score: 1, Insightful

    This is probably an excellent example of where cause and correlation are not the same thing.
    Here is my suspicion, as an old programmer. The REASON why spaces are encourage over tables is for consistency of printing on a physical paper.
    Which is unimportant or irrelevant if you are not. a) doing code reviews where you are passing out dead tree copies like may have been done 10 to 15 years ago OR b) submitting source code formatted on word docs as some part of documentation to a customer as government contractors are some times required to do.

    SOOO.... my hypothesis is that most people who regularly used spaces and were trained when it matters are either senior developers ( who tend to make more money) or working in government contracting, thus being the cause of the correlation noticed in the study. Of coarse without gathering enough data to control for the those variables you cannot have certainty of the answer. The original post doesn't include age of developer in it's data set as near as I can see , which to me is a obvious omission if you want to actually say anything useful about salary vs habits as many habbits will track with 'when' you trained.

    --
    âoeTolerance applies only to persons, but never to truth. Intolerance applies only to truth, but never to persons.
  5. Re:Possible Explanation... by donaldm · · Score: 3, Insightful

    Using spaces to indent is really kind of an OCD thing to do. There's the time and the counting and then redoing when you change something.

    So maybe the real lesson is the OCD programmers make a bit more than non-OCD programmers.

    If you are using a decent text editor (eg. gvim and emacs to name two) indentation is actually done by the editor and is fully customizable, all you as the coder has to do is make sure that what you are coding has as few errors as possible. If you have to worry about indentation then you are not doing it right.

    --
    There ain't no such thing as proprietary standards only proprietary formats. Standards are by definition open.
  6. Re:Both? by BronsCon · · Score: 5, Insightful

    I can actually see the argument for a 4-space indent consisting of 3 spaces and a tab. The developer thinks they're throwing a bone to people who use tabs by allowing them to set their own indent width. But they're wrong to use spaces at all in that case; what about people who prefer 2- or 3-char indents?

    And that's why tabs should be the standard: people prefer different indents. Using tabs, everyone can have their way; set your tab width and all tabbed indents are automatically the width you want.

    Now, for those who insist on tabs, let me explain why spaces are better: they allow you to align parameters and operators after the indent.

    That's why my preference is to use tabs to indent, then spaces to align after the indent; best of both worlds. You're already using the tab key to indent and the spacebar to align, so there's no mental or physical overhead involved, the layout of your code is preserved and, if someone else prefers a different tab width, they can have it without breaking the alignment of arguments or operators (if you bother to make them look pretty) or altering how the code displays for you, or anyone else.

    But, that's just a preference. When I'm working on someone else's code, I follow their conventions, because it really doesn't take any time at all to change an IDE setting (especially when my IDE can store per-project settings for things like tab width) and I'm not a dick.

    Beyond that, if someone uses tabs on some lines and spaces on others within the same file... yes, slap them silly.

    --
    APK quotes people (including myself) without context and should not be trusted. Just thought you should know.
  7. Re:Possible Explanation... by Gr8Apes · · Score: 5, Insightful

    The whole spaces vs tabs argument is so 90s, and seems more like arguing whether cow or bull leather whips are better.

    Intelligent devs use IDEs that handle all this formatting nonsense for them, removing the entire argument in the first place and just get things done. If your preferred language doesn't have a modern IDE that handles this for you, perhaps that tells you all you need to know about your preferred language.

    --
    The cesspool just got a check and balance.
  8. Re:Possible Explanation... by amicusNYCL · · Score: 5, Insightful

    Plopping something like this at the top of your file can help too:
    # ex: set tabstop=4 expandtab smarttab softtabstop=4 shiftwidth=4:
    # -*- Mode: tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- #
    (if your editor doesn't know what to do with those, it's not worthy of use)

    I delete that cruft when I encounter it. Editor settings belong in an editor, not in my code, thank you very much.

    --
    "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  9. Re:Possible Explanation... by greythax · · Score: 4, Insightful

    And truly intelligent devs check the "use spaces instead of tabs for formatting" in the options of their IDE...