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
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
Using spaces increased my earnings by 4x over tabs.
Programmers who use spaces are more likely to lie about how much money they make.
Support Right To Repair Legislation.
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?
One space or two after a period?
Sorry wrong crowd :P
(and don't you heathens dare say one)
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.
> 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.
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.
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.
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
Intelligent devs use IDEs
Would that be vim or emacs?
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.