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.

19 of 391 comments (clear)

  1. Tabspaces? by PCM2 · · Score: 5, Insightful

    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!
    1. Re:Tabspaces? by Anonymous Coward · · Score: 4, Insightful

      Any IDE can be configured to use spaces instead of when you indent.

    2. Re:Tabspaces? by PCM2 · · Score: 4, Insightful

      Do you really think people using spaces are sitting there tapping the spacebar 12 times for every line?

      Well no, so that's kind of my point. It's really tabs for everybody, because nobody has given a shit about the ASCII contents of text files for years.

      --
      Breakfast served all day!
    3. Re: Tabspaces? by PCM2 · · Score: 4, Insightful

      Also, please stop moving the goal posts, first you said "text files" and now you suddenly shift to "source code files". Not cool.

      Sorry, I forgot about the combination of not reading the stories and the autism spectrum. My bad.

      --
      Breakfast served all day!
    4. Re: Tabspaces? by gfxguy · · Score: 5, Interesting

      Python is my go-to scripting language when possible, but it's the one thing about it that bothers me - the anal retentive way it forces you to follow Guido's formatting standards. Yes, there is some choice, but when you figure out that tabs make more sense you become an outcast in the python community.

      --
      Stupid sexy Flanders.
    5. Re: Tabspaces? by dfghjk · · Score: 4, Insightful

      As objectionable as it sounds, python's odd approach to white space doesn't present problems in practice nor does anyone using any reasonable editor have problems with "tabs vs spaces" in Python. It's a non-issue.

      The real violator is make. It actually requires tabs where spaces would otherwise work. It is an actual problem yet no one claims make is for "faggots" except perhaps AC a-holes like you.

    6. Re:Tabspaces? by Z00L00K · · Score: 4, Interesting

      That's when it's time to run the code through a formatter an check it in again.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
  2. Re:The article conveniently ignores Python by Anonymous Coward · · Score: 4, Informative

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

  3. Doesn't matter who "wins" by LordLucless · · Score: 4, Insightful

    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
  4. Spaces are for people who don't understand tabs by Viol8 · · Score: 5, Insightful

    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"

    1. Re:Spaces are for people who don't understand tabs by johnw · · Score: 4, Insightful

      It's a nice idea in theory, but it's never worked - nor is it the point of tabs.
      If all indents were always solely at the beginning of a line, and always an exact multiple of whatever N you've chosen then it might have a chance, but they aren't and so it just breaks.

      Don't mess with the size of a tab character - you'll just cause pain.

    2. Re:Spaces are for people who don't understand tabs by serviscope_minor · · Score: 4, Insightful

      Ick no!

      Use only tabs to indent to the beginning of the indent level. Use spaces for all other alignment, including if you want to go a little further in than the indent level for some reason.

      Then, it all works perfectly and in 99.9999% of cases, someone can change the width of the tab character to whatever they like and it'll look right.

      Then silly people can use tab=8, weirdos can use tab=2 sick fucks can use tab=3 and the rest of us can view it as the gods decreed with tab=4. Feel free to permute that as per your preference except for the tab=3 clause.

      --
      SJW n. One who posts facts.
  5. Theory vs. Practice by rockmuelle · · Score: 5, Insightful

    In theory, tabs are the right solution. In practice, spaces are the right solution.

    -Chris

    1. Re:Theory vs. Practice by TFlan91 · · Score: 4, Interesting

      I disagree.

      I disagree with the whole debate entirely...

      Tabs for indentation, spaces for alignment AFTER indentation... Tabs so that people can choose whatever width they want, but after that width (meant for indentation of blocks) use spaces to align whatever you want...

      It really isn't that hard and it pleases everyone.

  6. Re:what he said by gaudior · · Score: 4, Insightful

    Usually this results in a totally garbled python script.

    This is why I avoid Python. Program logic should not be governed by invisible things.

  7. Re:Both. by WallyL · · Score: 5, Insightful

    Ew. That's an unusual combination of tabs and spaces.
     
    ...and also because of Emacs.

  8. 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
  9. one thing the tabs and spaces folks agree on by dlang_rocks · · Score: 5, Funny
  10. People use spaces four times as often as tabs! by Richard+Kirk · · Score: 4, Funny

    (snigger)