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.

28 of 515 comments (clear)

  1. Pied Piper proves it too ... by drnb · · Score: 4, Funny

    Pied Piper proves it too, that tab loving company is one money losing screwup after another.

  2. 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
  3. 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 drnb · · Score: 3, Informative

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

      Those are global averages. Keep reading and you'll see the region specific charts and numbers. I think the averages for the US were around $100K and $80K.

    2. 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.
  4. Of course they earn more! by DontBeAMoran · · Score: 5, Funny

    Those idiots take four times longer or more to indent their code compared to those of us who use tabs and get home earlier thus working less hours.

    --
    #DeleteFacebook
  5. That's because they get paid by the character by JoeyRox · · Score: 5, Funny

    Using spaces increased my earnings by 4x over tabs.

  6. Did they take language into account? by RobinH · · Score: 3, Interesting

    I'd think that space vs. tab use is highly dependent on which programming language you're using, and I'd also think that language is correlated with earnings, so I highly doubt this conclusion (if they're trying to conclude anything). Correlation is not causation.

    --
    "I have never let my schooling interfere with my education." - Mark Twain
    1. Re:Did they take language into account? by Anonymous Coward · · Score: 5, Informative

      If only they had a graph that displayed how they checked for your easy explanation and controlled for it.

      Oh wait, they did.

      Have you ever heard of clicking on a link?

  7. Re:Yeah but by Coisiche · · Score: 4, Funny

    Most of the respondents wouldn't have understand the question because they actually use whatever their IDE does.

  8. Eclipse serializes with spaces or tabs by prefec2 · · Score: 4, Informative

    Modern IDEs format code automatically and use spaces or tabs based on your settings. In addition, the auto formatter automatically adds whitespace when you go into the next line. It is most likely not a real dependency between whitespace and salaries, but it has more to do with which environment they use.

  9. Alternate interpretation of the data by Comboman · · Score: 5, Informative

    Programmers who use spaces are more likely to lie about how much money they make.

    --
    Support Right To Repair Legislation.
  10. OB Scene from "Silicon Valley" by Leomania · · Score: 3, Informative
    --
    You don't use science to show that you're right, you use science to become right.
  11. The real question... by crashumbc · · Score: 5, Funny

    One space or two after a period?

    Sorry wrong crowd :P

    (and don't you heathens dare say one)

    1. Re:The real question... by sl3xd · · Score: 3, Informative

      It is two when using a typewriter. :-)

      I learned to type with a typewriter, and back then most printers had a single fixed-width font, so it was still considered proper form to double-space after a period.

      It wasn't until a couple years ago I learned that it wasn't considered proper form to double-space; decades of muscle memory are hard to unlearn.

      --
      -- Sometimes you have to turn the lights off in order to see.
  12. Possible Explanation... by sycodon · · Score: 3, Interesting

    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.

    --
    When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
    1. 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.
    2. Re:Possible Explanation... by ShanghaiBill · · Score: 4, Informative

      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.

      Uhh .. no. Whether you use tabs or spaces is an editor config setting. At the human UI level it is barely even noticeable.

      I use spaces at work so the code looks the same for everyone. For Python, I always use spaces since whitespace is part of the syntax. For other languages, I am not even sure. I would need to look at my .emacs file.

    3. Re:Possible Explanation... by DrStrangluv · · Score: 5, Interesting

      > For Python, I always use spaces since whitespace is part of the syntax. For other languages, I am not even sure. I would need to look at my .emacs file.

      I think you've hit the crux of it. Emacs, Visual Studio, and Eclipse (at least) all use tabs by default. What we may be seeing is a selection for people who know enough about their environment to configure it to work for them.

    4. 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.
    5. Re:Possible Explanation... by ShanghaiBill · · Score: 5, Funny

      It should be 2.

      It depends on the language. For bracketed languages like C++, Java, and Javascript, 2 spaces is correct. But for indented languages like Python, 4 is better to make the structure more clear.

      What I really can't stand is people that use 8. That is never the right choice. My wife uses 8 spaces, and we have had plenty of arguments over that, especially when she edits my code, changes the indentation and then checks it back into the git repository with 100% of lines changed. But the final straw was when she started teaching the kids to use 8 spaces. We almost got divorced over that. I fought for 2, she fought for 8, so we compromised, and the kids are using 4 space indents, although neither of us is happy about that.

    6. 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
    7. Re:Possible Explanation... by 0100010001010011 · · Score: 5, Funny

      Intelligent devs use IDEs

      Would that be vim or emacs?

    8. Re:Possible Explanation... by Anonymous Coward · · Score: 5, Funny

      What I really can't stand is people that use 8. That is never the right choice. My wife uses 8 spaces, and we have had plenty of arguments over that, especially when she edits my code, changes the indentation and then checks it back into the git repository with 100% of lines changed. But the final straw was when she started teaching the kids to use 8 spaces. We almost got divorced over that. I fought for 2, she fought for 8, so we compromised, and the kids are using 4 space indents, although neither of us is happy about that.

      This is why it is so important to get to know each other before getting married. My church recommends starting an open-source project together before even getting engaged, you learn so much about a person just settling on which license to use.

    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...

  13. 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.
  14. Re:Both? by beelsebob · · Score: 3, Interesting

    The reason that most places don't have these check in hooks is simple - rule 1 in all good style guides is "if breaking the style guide in one off cases makes code substantially clearer, break the style guide."

    Humans need to have the ability to say "no, in this one case it makes sense to do something odd to make this code readable".