Developers who use spaces to indent aren’t just better, they’re richer, too

“When it comes to indentation, there’s a right way and a wrong way. The right way, of course, is with spaces,” Matthew Hughes reports for TNW. “Those who use tabs aren’t just doing it wrong, but they’re also cheating themselves out of a decent wedge of cash.”

“At least, that’s the case according to Stack Overflow’s 2017 Developer Survey, which found that the median developer who uses spaces over tabs earns roughly £13,000 ($16,500) more,” Hughes reports. “Stack Overflow surveyed almost 26,000 developers. 40.7 percent of those surveyed said they use tabs, while 41.8 percent used spaces.”

Hughes reports, “Interestingly, the median spaces-using dev earns $59,140 per year, while those who cling to tabs earn $43,750.”

Read more in the full article here.

MacDailyNews Take: Tab-using devs, you’ve been warned! Switch to spaces!

28 Comments

    1. A tab can be set to different space widths on different editors, spaces preserves the formatting.

      Also what will tend to happen over time, is someone will use tabs, then the next developer to modify it will use spaces, and while the code will all line up on his editor, if someone else opens it with a different tab setting, the code formatting is gone out the window.

      Spaces ensures consistency no matter who is looking at the code

        1. So someone actually voted down the tab character being 5 spaces. 5 spaces in the official, standards body definition? That’s what it is. Word processors or text editors do allow you to customize your layout, but they do not change the characteristics of the tab character.

    2. You’re asking a website called “Stack Overflow” why they think a subtle coding aesthetic is important? GOOD GOD MAN! 🙂

      Ask a musician to pontificate on the difference between a C Flat and a B Sharp. Or a patio salesman the difference between a grill party, a cookout and a barbecue. Or a hiker whether they prefer Trail Mix or GORP.

      Life is better with pointless arguments.

      1. Perhaps so, but when the data points to a quantifiable discrepancy between the two groups, the argument looks increasingly less pointless.

        If I were a tab coder (which I’m not — spaces FTW!), statistically, I should be concerned that my tabbing is depriving me of a better salary. The correlation is clearly there, and the goal should now be to find the cause. Perhaps the bulk of hiring managers consider tabbing bad coding practice, so it ends up unchecking a critical box in their mental hiring checklist…?

      2. C-flat is ‘b’
        B-sharp is ‘c’

        you might mean the difference between C-natural and B-sharp or the difference between C-flat and B-natural… just a thought.

    3. The great goal is ‘Readability’. Readability is a requirement of the Guild of Coders. Great tomes have been written about how to make your code readable. The concept is that one’s code must be entirely intelligible by other coders who may some day be asked to amend it, extend it or repair it. Coders who ignore readability are considered less that amateur. They are treated as barbarians and must be destroyed. They are the bane of any coding team and in worst cases can cost company $millions$ when changes in their code are required. Think: Macromedia Flash, poorly readable, poor documentation, Adobe buys it, eternal, endless, expensive, exasperating security patches result.

      Issue #1: Ease versus file size.
      Those who want the smallest possible code file size will choose tabs. Spaces take up one byte per space. Eight spaces = eight bytes. Using a tab instead saves seven bytes.

      However, as others here have pointed out, if you pass your code around your tabs may have variable translations into visual space on different word/code processing programs. Thus your ‘perfectly’ tabbed code loses its ‘perfection’.

      Issue #2: Tabs only require one keyboard click, thus saving ‘time’ and ‘finger stress’.

      Issue #3: Spaces create more ‘clicking’ noise. ‘Click Click Click’ like Chinese water torture.

      Issue #4: If you have a lot of indentations between your lines of code, which is commonly the case, it’s a lot faster and easier too just hit the tab button a relatively few times to get to the start of a new line of code rather than mashing on the space bar to get there.

      ∑ = It’s all about one’s personal definition of being ‘anal’. Newbies will enjoy this article:

      https://en.wikipedia.org/wiki/Anal_retentiveness

      Steve Gibson and Leo Laporte had a discussion about this subject, one which was stimulated by the program ‘Silicon Valley’. (Search on YouTube for “silicon valley tabs vs spaces”). You can read their exchanges in the transcripts of ‘Security Now!’ episodes #576 and #577.

      Steve Gibson uses tabs and won’t switch. Leo points out that Steve doesn’t share is code with others, Steve has a set word/code processor he uses, so he doesn’t care about ‘Readability’. Steve reads his own code tabbed just fine. Leo points out the savings of seven bytes when using tabs versus typing 8 spaces.

      If all this has put you to sleep, you’re forgiven. 💤💤

      I personally don’t see the BFD. Decent word/code processors will let you configure them to the nth degree, especially regarding tabs versus spaces. I like BBEdit. You can have tab stops show on your page, making it easier to space over to the start of the next line of code. You can, alternatively, set the number of spaces equal to one tab making tabbing easy.

      13 of one, a baker’s dozen of the other.

      1. I go OCD on spaces, precisely 4, per indent.

        When you use tabs, and if you switch IDEs for one reason or another, indents get out of whack, and spaces don’t do that. Maybe that’s in a mixed tabs spaces environment. I just settled on spaces.

        1. Side point inferred by my description of setting tabs to equal a particular number of spaces in BBEdit: Use tabs! BBEdit translates them into spaces for you. I can do this in some other word processors as well.

  1. Unfortunately, they can’t even make a guess why this is so.

    It’s probably not like if I use spaces I’m suddenly going to make a bunch more money.

    So what does the use of spaces correlate to — the actual reason why someone makes more money? An indicator of a certain type of education? Demographic group? What?

    1. I has hypothesized that it may have something to do with hiring managers and their attitude to usage of tabs. If there is some common opinion that tabbing leads to unclear code, the practitioners of tabbing may be evaluated poorer than the spacers, all other things being equal. Therefore, better jobs may go to spacers, leaving tabbers with inferior offers for less money.

      As I said, just a wild, somewhat educated hypothesis.

      1. Seriously doubt it. No hiring manager would hire on such a basis. Certainly not the kind of one that pays high salaries. And no highly skilled developer would balk at using whatever the team is using. Any developer who insists on one or the other probably isn’t that much of a team player and less likely to be paid well.

        A good dev likely will just use whatever is more commonly used by the team. It’s that simple. Many if the senior members on a team come from an era where spaces mattered more as tools weren’t as developed. As such they’ve set the standards for the team. It’s that simple really.

  2. Correlation is not causation.

    Space developers are usually older as they come from a time when it mattered more. Developers who have been around longer usually get paid more.

    These days most editors allow better control of indentation size. Tabs are far superior as they’re more semantic. An indent shows levels. One tab, one level. Spaces are arbitrary and some devs use two and some use four and some use three. Most editors even convert back and forth between the two so it’s a moot point.

    The reality is that new devs probably use spaces more commonly because they make more sense these days. However as the mature as a coder they switch to what their more mature colleagues are using just to fit in.

    Saying spaces is better is like saying using an absolute size like pixels to size fonts and line spacing are better than relative units like ems and vh. They’re not. They just reflect the comfort zone of a developer who was used to print on an absolutely sized medium or was constrained by limitations of older browsers.

    Tabs are better. But we have biases. If I work on a team that uses spaces I’ll switch. If I work on a team that uses tabs I’ll use those. I’ll get paid handsomely either way.

    1. Thank you! Conclusions made from correlation have been the prime source of hatred and disbelief toward Statistics.

      Do what works for you. One’s sanity is far more important than a foggy correlation between tabs with money.

      Does anyone else here think of this article as an April Fools prank?

  3. I always felt tabs were better when used consistently because each individual developer could set the tab size themselves according to preference or screen size.

Reader Feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.