400,000 GitHub Repositories, 1 Billion Files, 14TB of Code: Spaces or Tabs? (medium.com)
Here's a debate that refuses to die: given a choice, would you rather use spaces or tabs? An episode of Silicon Valley last season had a bit on this. Now we have more data to analyze people's behavior. A Google developer has looked into 400,000 GitHub repositories -- 1 billion files, 14 terabytes to find that programmers with interest in specific languages do seem to prefer either tabs or spaces. Spoiler alert: space wins, like all the time.
Yeah, OK, I get it. Spaces make it easier to cut and paste your code into whatever and have it look the same. But does anybody seriously type all those spaces? You don't just set the Tab key to expand to spaces?
Breakfast served all day!
Popularity is a poor measure of quality. Otherwise McDonald's would be Michelin starred.
Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
The whole point of a tabstop is you can change its width so a file can be indented to the preference of the person reading/editing it (set ts=[width] in vi). With spaces you're stuck with the (often poor) indentation the author chose who is essentially saying "Fuck you, you're going to read the code indented the way I want, not the way you want"
In theory, tabs are the right solution. In practice, spaces are the right solution.
-Chris
Usually this results in a totally garbled python script.
This is why I avoid Python. Program logic should not be governed by invisible things.
Ew. That's an unusual combination of tabs and spaces.
...and also because of Emacs.
It's all these Java and HTML heathens skewing the results. If you look a C files the majority use the correct tabs for indentation and optionally spaces for alignment later.
If god wanted us to use spaces for indentation he wouldn't have made keyboards with tab keys. Also, they reduce wear on your space bar and fingertips.
TABS!
const int one = 65536; (Silvermoon, Texture.cs)
SJW, n: "Someone I don't like, and by the way I'm a fuckwit" - AC
If you use proportional fonts for programming, you deserve every bad thing that happens to you.
You have to use tabs, sure, but how on earth are they going to know what width you set them to?
SJW n. One who posts facts.
But that's what I like about tabs. They can be set to display as however many columns each individual wants, rather than requiring everyone to agree on the same number. 4? 3? 8? Pi?
The regex used for determine tab vs. space is r'[ \t]', which matches the first space or tab in a line, not whether or not the first character in a line is a space or tab. Thus, for example, a using statement in C# (using System;) would count towards the spaces total where it shouldn't count towards either (unless preceded by spaces or tabs for some reason).
Fix the regex (r'^[ \t]') and rerun it, i doubt it will allow tabs to win (tabs rule spaces drool), but it would give more accurate results for the charts.