Oh how the tables have turned: A simple answer to the tabs v spaces dilemma
© Shutterstock / Maksutov
It’s decided! There’s only one way to end the tabs v spaces war and that’s by adding money to the equation. Stack Overflow has just released the raw data of its annual Developer Survey and it seems that the fate of the war between the two camps has been decided: developers who use spaces make more money than those who use tabs.
Tabs v spaces: Tale as old as time
This is one taboo topic we all need to talk about. The tabs v spaces discussion dominated an entire episode of the ‘Silicon Valley’ sitcom last year and we all remember Jeff Atwood’s 2009 post titled Death to the Space Infidels.
Choose tabs, choose spaces, choose whatever layout conventions make sense to you and your team. It doesn’t actually matter which coding styles you pick. What does matter is that you, and everyone else on your team, sticks with those conventions and uses them consistently.
That said, only a moron would use tabs to format their code.
If you have time to waste and you are willing to read over 400 comments, check out this Reddit thread in which developers explain why they use tabs or spaces and why their way is the right way. One of the most popular theories belongs to ForeverAlot, who claims that the tabs v space war is a “people problem that exists because spaces and tabs cannot naively be distinguished. It starts with the desire to avoid inconsistent whitespace, for some definition of consistent […] The best way to sidestep the issue is to prefer spacing code out vertically, allowing you to use multiples of indentation levels instead of aligning code.”
SEE ALSO: Tabs are officially better than spaces
Stack Overflow findings: 2015 v 2017
We already presented some of the Stack Overflow developer survey findings but so far the tabs v spaces war has not made an appearance. David Robinson, Data Scientist at Stack Overflow announced in a blog post that the war between developers who prefer spaces and those who favor tabs may finally come to an end.
According to Robinson, there is a salary difference between developers who use tabs and those who use spaces. As it turns out, 28,657 survey respondents provided an answer to tabs versus spaces: 40.7 percent use tabs and 41.8 percent use spaces (with 17.5 percent using both). Of them, 12,426 also provided their salary. Although they have the same amount of experience, the survey results show that developers who use spaces for indentation make more money than ones who use tabs.
Developers who use spaces instead of tabs have a 8.6 percent higher salary. Put another way, using spaces instead of tabs was worth as much as an extra 2.4 years of experience, Robinson concluded.
Two years ago, the findings were a bit different. 45 percent of respondents sided with tabs as their preferred key du jour, with 33.6 percent hitting the space bar. However, after looking at the data more closely, Stack Overflow noticed that developers increasingly prefer spaces as they gain experience. Further analysis also indicated that Stack Overflow reputation correlates with a preference for spaces: users who have 10,000 reputation points or more prefer spaces to tabs at a ratio of 3 to 1.