Slashdot Mirror


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.

3 of 391 comments (clear)

  1. Re:The article conveniently ignores Python by Anonymous Coward · · Score: 4, Informative

    Wrong: https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

  2. Re:what he said by TangoMargarine · · Score: 4, Informative
    --
    Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
  3. Re:Spaces are for people who don't understand tabs by cfalcon · · Score: 2, Informative

    > a file can be indented to the preference of the person reading/editing it

    No, fuck that. I shouldn't have to mess with my editor to get sane spacing. Code is text, not binary. Get the binary out of the code. What if my editor isn't able to do that, and what if I need to use a text mode or command line? Fuck all that hassle.

    And to flip it: if you really need to see it with some OTHER number of spaces than are actually there, I bet there's a text transform you could apply to the spaced file too. We don't need to start putting tabs places to get this.

    What if you EVER need to indent something, but less than the full amount? You are outta luck with tabs.
    What if you are writing something where you want a character to exist directly underneath another, but one is preceded by non-whitespace, and the other by whitespace? With spaces, you just do that, with tabs, fuck you.
    A tab means very different things to different programs. Unless your code is just for you, you don't know the future use case of future programmers. You don't know if it will be output in a shell, in an editor where tab is interpreted, not as a number of spaces, but as instructions to go to a tab stop (you know, the actual intended use of tab in formatting), or as some other thing completely.

    But really its simple: a space is a space. A tab is a formatting instruction that every coder from that point must deal with in every display device that the code is viewed on, taking it from a simple text file to some binary file that requires everyone tweak settings for, as well as the unspoken condition that certain types of formatting become impossible (line A has a standard indent followed by the word "Quintuple", line B is supposed to have a character underneath the "p"- can't do that with tabs and have it be display independent anymore)... Tabs work for the tabber, and the tabber alone. Spaces work for everyone.