Google Coder Analyses A Billion Files To Find A Winner In Tabs Vs Spaces Debate

Google Coder Analyses A Billion Files To Find A Winner In Tabs Vs Spaces Debate

It’s one of the greatest battles ever fought among coders: Should you use the tab button or four spaces when you’re indenting in source-code?

Image: HBO

The debate ultimately boils down to how source-code is displayed in editing software. The reason people get angry is because the code doesn’t display nicely if the same method isn’t used throughout the file. This can get especially tricky when multiple people are working on the same project. The debate has gone on for so long that coders are now referred to as “tab people or “space people”. It was even referenced in a recent episode of Silicon Valley.

Google developer Felipe Hoffa decided he wanted to get to find a winner of this debate. So he parsed one billion files among 14 different programming languages to find out which method is actually more popular and then published the results in a recent blog post on Medium.

Google Coder Analyses A Billion Files To Find A Winner In Tabs Vs Spaces Debate
Images: medium / @hoffa

Images: medium / @hoffa

The data Hoffa used was sourced from GitHub files stored in BigQuery. He made sure there were no duplicates or files with less than 10 lines of code. The developer also gave one vote per file (so if it used both tabs and space, the vote went to whichever was used more frequently). Finally, the top 400,000 repositories were sorted by the number of stars they received on GitHub between January 2016 and May 2016.

Here’s what he found:

Google Coder Analyses A Billion Files To Find A Winner In Tabs Vs Spaces Debate
Images: medium / @hoffa

Images: medium / @hoffa

As you can tell from the data, the overwhelming winner here is spaces. In every major programming language besides C, spaces were used in the most popular files on GitHub. This evidence is about as definitive as it will ever get in revealing whether tabs or spaces are more popular in code.

But why? Space People will tell you that this is a no-brainer because spaces display the same across all hardware, text viewing software and they’re flat out more visible than stupid tabs. Of course, Tab People might have a much different opinion about that.

Are spaces qualitatively better than tabs for some reason? It remains unclear. If you have a strong opinion either way, though, please fight it out in the comments.


The Cheapest NBN 50 Plans

It’s the most popular NBN speed in Australia for a reason. Here are the cheapest plans available.

At Gizmodo, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.