Author Topic: Tabs Versus Spaces  (Read 103 times)

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 3810
Tabs Versus Spaces
« on: July 14, 2017, 07:11:51 PM »
Tabs versus Spaces

The great programming holy war

So, what are the stats on tabs versus spaces? Turns out, someone has analysed this for GitHub repositories, and broke down the result by language:
Tabs or Spaces

There is quite a variation between languages. For spaces, they also broke down how many spaces are used for indentation.


To add some more data, and a bit of humour to this:
Developers Who Use Spaces Make More Money Than Those Who Use Tabs

There was some investigation into the data to try and find confounding factors. The main article comes up empty, though some of the comments are quite good. Of particular note was the graph in the comments that mentions the two salary peaks for the developers who use spaces. I could see that being really easy to miss.


Finally, there's this YouTube video:
Tabs versus Spaces
 :P

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3170
    • http://
Re: Tabs Versus Spaces
« Reply #1 on: July 15, 2017, 10:04:38 AM »
What about tabs that get converted to spaces?
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

"Outpost 2: The Campaigns Are Okay, But The Novella Just Flames Everyone" progress:
Campaign 1 - 40%
Campaign 2 - 0%
Etc. - (insert arbitrary value here)%

It could only cost you your life, and you got that for free!

Offline lordpalandus

  • Sr. Member
  • ****
  • Posts: 404
Re: Tabs Versus Spaces
« Reply #2 on: July 15, 2017, 11:47:45 AM »
What about those crazies that use neither tabs or spaces, preferring to push out spaggetti code quickly and hope that they never have to touch the code again? Do they make the most money of all?
BAM! You've been facehugged! Have a great day!

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 3810
Re: Tabs Versus Spaces
« Reply #3 on: July 15, 2017, 07:17:56 PM »
Quote
What about tabs that get converted to spaces?
Mind blown :o

Quote
What about those crazies that use neither tabs or spaces, preferring to push out spaggetti code quickly and hope that they never have to touch the code again? Do they make the most money of all?
Clearly. Or not clearly. That's why they have the code obfuscation contests. ;)

Offline leeor_net

  • Administrator
  • Hero Member
  • *****
  • Posts: 1451
    • LairWorks Entertainment
Re: Tabs Versus Spaces
« Reply #4 on: July 18, 2017, 08:59:31 AM »
Tabs.

If you use spaces you're wrong.

Offline Vagabond

  • Sr. Member
  • ****
  • Posts: 356
Re: Tabs Versus Spaces
« Reply #5 on: July 19, 2017, 05:05:29 AM »
I just press the tab key, let the IDE figure out how to interpret based on its default settings, and never look back.

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1119
Re: Tabs Versus Spaces
« Reply #6 on: July 19, 2017, 11:50:31 AM »
I prefer 2 spaces. Tabs are just bad, their size is hardly ever consistent between editors even with the same monospace font.

Offline White Claw

  • Hero Member
  • *****
  • Posts: 525
Re: Tabs Versus Spaces
« Reply #7 on: July 19, 2017, 06:37:33 PM »
"Back in my day" we ended up using Spaces because Tabs would come out as different sizes depending on the printer you used...which could cause your code to go over 80 columns, subsequently not printing out your entire line of code. A tab could look like "five spaces" to a printer, but maybe only looked like "three spaces" on your computer screen.

Although now (as someone else mentioned above) I just let the IDE do it's thing...which ultimately means (for me) that it auto fills the spaces to indent properly. So there goes the argument "why press space space space space, when you can just press Tab once"...I do neither.

I think my favorite quote I stumbled upon while reading about "space vs. tab" is:

Quote
In theory, practice and theory are the same. In practice, they are not.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 3810
Re: Tabs Versus Spaces
« Reply #8 on: July 19, 2017, 10:33:02 PM »
I love that quote too. So awesome.


My main complaint about the tabs versus spaces debate, is that it's a global editor setting, but a per project decision. I don't want to change global editor settings when switching between projects.