Sign up for all the latest tips, tricks, and trends
    

Address: No. xx, Building xx, xx Square, xx Road, Shanghai

Phone: 86-130-xxxx-0000

Fax: 86-021-xxxxxxxxxxxxxxxx

E-mail: xxxxxxxxx@qq.com

Website: www.xxxxxx.com

It's More Profitable for Developers to Use Spaces than Tabs 


Is your code indented with tabs or spaces? Software developers are engaged in a kind of "holy war - one that has sparked debates and in-jokes throughout history. Although I use spaces, I never thought they were particularly important. Stack Overflow is releasing raw data for the 2017 Developer Survey today.


Bonus: You can use spacebar clicker to take a spacebar click test. For typing a code a spacebar is used mostly or frequently. Hence, you must have higher spacebar speed.  



Spaces earn more profit than tabs


28657 survey respondents indicated their preference for tabs or spaces, and 88% considered themselves professional developers (as opposed to students or former programmers). The percentage of those using tabs is 40.7%, whereas the percentage of those using spaces is 41.8% (with 17.5% using both). 12,426 of them also paid their wages.



We come to an interesting conclusion after analyzing the data. Even if they have the same amount of experience, coders who use spaces make more money than those who use tabs.



A developer using spaces has a median salary of $59,140, while a developer using tabs has a median salary of $43,750. (Note that all the results were converted from each respondent's currency into US dollars.) Those who responded "Both" were generally indistinguishable from those who replied "Tabs": I'll leave them out of the remaining analyses.



This is an amusing result, but it's not conclusive. Initially, I assumed that it was due to a factor such as country or programming language. As an example, developers in low GDP-per-capita countries could be more likely to use tabs, meaning that such developers tend to have lower salaries on average.



It may be possible to examine whether this effect occurs within each country, for several of the countries with the most survey respondents.



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.



In a different hypothesis, we understand that different types of developers use different indentation styles (e.g. DevOps developers often use spaces, and mobile developers typically use tabs), often because they use different editors and languages. The Developer Survey asked respondents what programming languages they use (Python, JavaScript, etc) and what types of developers they are (web developers, embedded developers, etc).



Is there a similar gap in tabs/spaces between these groups?



There was an impact within every subgroup of developers. (This gave a similar result even when it was filtered for developers in a particular country, or for people with a particular range of experience). Because respondents could select multiple languages, each of these groups overlaps to some extent.



In other analyses I did (such as those concerning education level or company size) I found the same outcome: spaces won within each group despite confounding factors. I encourage other statisticians to check other confounders now that raw data is available.



Effects estimation


Even if we control for all factors that could affect salary, how much of an impact does the choice of tabs/spaces have?

For this question, I fitted a linear regression, predicting salary based on the following factors.


  • Tabs versus spaces
  • The country
  • Expertise in programming for years
  • Development type and language (for 49 responses with at least 200 "yes" votes)
  • Education level (e.g. bachelors, masters, doctorates)
  • Contribution to open source
  • Programmers who are hobbyists
  • Size of the company



Based on the calculations, using spaces instead of tabs caused an increase in salary of 8.6% (confidence interval (6%, 10.4%), p-value* 10^-10). (We were able to estimate the percentage change in salary instead of the dollar amount by predicting the logarithm of the salary.). A difference of as much as 2.4 years in experience is associated with using spaces instead of tabs.



Final Thoughts


I was totally surprised to find this result when I began exploring the data. Even after controlling for many confounding factors, the results are impressively robust. In this exercise, I controlled for many other factors within the survey data beyond those mentioned here, but it was difficult to make the effect shrink and practically impossible to make it disappear.



The measurement of confounding factors in a survey and our ability to control for them cannot be assured, so we are unable to guarantee our results are causal. To those of you who are data scientists, statisticians, or analysts, I encourage you to download the raw survey data and investigate it for yourself. If you'd like to reproduce this analysis, you can find the code here. However, we would be interested in hearing hypotheses about this relationship.



Nevertheless, for my own salary, I must stick with spaces for now.


Reserve My Spot