Tabs versus Spaces? Not Just Contentious But Economic
Written by Sue Gee   
Friday, 16 June 2017

Tabs versus spaces is a topic that divides opinion like no other programming topic. Now it seems your preference for indentation isn't just a personal matter, it impacts what you are likely to earn.  

stackoverflowbanner

The surprising finding that developers who use spaces for indentation make more money that those who use tabs comes from Stack Overflow's Data Scientist David Robinson in a blog post that also announces that the raw data for the Stack Overflow Developer Survey is available for download.

The question do you tabs or spaces for code indentation was included in the 2017 Stack Overflow survey conducted between January 12th and February 6th. Of the 64,000+ developers from 213 countries who participated, almost 40,000 answered it and overall Tabs prevailed, with 43% using them compared to 38% using Spaces and 19% Both tabs and spaces. 

StOvTabsSpaces

 

In his analysis of the data Robinson looked at only at Professional developers and here Space users outnumbered Tab users by a slim margin, 42% to 41%, and the Both response was reduced to 17%. Of this group nearly half provided their salary and with this data Robinson produced this chart of salary by years of experience for the three groups.

 

stoverc1

Robinson clarified:

The median developer who uses spaces had a salary of $59,140, while the median tabs developer had a salary of $43,750. (Note that all the results were converted into US dollars from each respondent’s currency). Developers who responded “Both” were generally indistinguishable from ones who answered “Tabs”.

As salaries differ widely by country Robinson investigated whether a regional preference for type of indentation could explain the result.

 

stovercgeog

 

Having looked at countries that had the most survey respondents, Robinson concluded:

The effect is smaller in Europe and especially large in India, but it does appear within each country, suggesting this isn’t the sole confounding factor.

He then investigated whether the Tab/spaces gap could be explained by the languages used by respondents and their developer type - data scientist, web, embedded and so on and discovered that the effect persisted.

Going further he asked:

If we control for all of the factors that we suspect could affect salary, how much effect does the choice of tabs/spaces have?

To investigate this Robinson fitted a linear regression, predicting salary based on the following factors: 

  • Tabs vs spaces
  • Country
  • Years of programming experience
  • Developer type and language
  • Level of formal education (e.g. bachelor’s, master’s, doctorate)
  • Whether they contribute to open source
  • Whether they program as a hobby
  • Company size

The conclusion was: 

The model estimated that using spaces instead of tabs leads to a 8.6% higher salary (confidence interval (6%, 10.4%), p-value < 10^-10). (By predicting the logarithm of the salary, we were able to estimate the % change each factor contributed to a salary rather than the dollar amount). Put another way, using spaces instead of tabs was worth as much as an extra 2.4 years of experience.

One thing that surprised me about the data was that spaces were not more prevalent, given the result we reported last year from an analysis of 400,000 GitHub repos which together held 1 billion files and 14 terabytes of code which showed that tabs beat tabs by a large margin, see Tabs Or Spaces - One Billion Files Later An Answer.  


tabs

 

This study indicated very different proportions of tab use according to language - for example Go developers always use tabs and the majority of C programmer do. On the other hand Ruby developers only use spaces, and so do most Pythonistas, and the majority of  Web developer (JSON, HTML and to a lesser extent JavaSrcipt).

Looking at another analysis, that of Top Starred GitHub repos from Uku Pattak, reveals languages that use spaces, exclusively or almost exclusively - including Clojure, Rust, F#, Elixir which, as we reported back in March (see Developer Pay Satisfaction According To Stack Overflow) are the top paying technologies on a worldwide basis in the Stack Overflow Survey.  Scala, which is the second most highly paid technology in the US is also shown to be a space--only language. The tab-exclusive Go, on the other hand, is the top paying technology in the US and 5th on a global basis, which goes against the attempted hypothesis that languages that insist on spaces are inherently better paid.

Whatever the reason for Robinson's finding it might help temper the tabs versus spaces debate that can get very heated, even at a personal level. If you are a fan of the TV series "Silicon Valley" you will remember the way in which it ruined Richard Hendrick's budding relationship with Winnie, who has written code with spaces instead of tabs, declaring: 

"there's no way I'm going to be with someone who uses spaces over tabs."

If you accept that using spaces rather than tabs can earn you a significantly fatter pay packet, its difficult to stick to that attitude. 

 

 

paysq

More Information

Developers Who Use Spaces Make More Money Than Those Who Use Tabs

Stack Overflow Developer Survey Results 2017

Tabs or Spaces (Uku Pattak)

 

Related Articles

Developer Pay Satisfaction According To Stack Overflow

Tabs Or Spaces - One Billion Files Later An Answer

Banner


Meta Releases OpenSource Podcast Generating Tool
28/11/2024

Meta has released an open source project that can be used to automatically convert a PDF file into a podcast. Meta says Notebook Llama can be considered an open-source version of Google's NotebookLM.

 [ ... ]



Hour Of Code 2024 Is About To Kick Off
04/12/2024

This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Friday, 16 June 2017 )