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.
Proof: neither side makes jack-shit as a coder
If the median salary was under $50k, then I'm not sure who they were surveying, but it wasn't professional developers.
https://www.eff.org/https-everywhere
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.
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.
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
And truly intelligent devs check the "use spaces instead of tabs for formatting" in the options of their IDE...