Outpost Universe Forums
Off Topic => General Interest => Topic started by: Hooman on July 14, 2017, 09: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 (http://ukupat.github.io/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 (https://stackoverflow.blog/2017/06/15/developers-use-spaces-make-money-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 (https://www.youtube.com/watch?v=SsoOG6ZeyUI)
:P
-
What about tabs that get converted to spaces?
-
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?
-
What about tabs that get converted to spaces?
Mind blown :o
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. ;)
-
Tabs.
If you use spaces you're wrong.
-
I just press the tab key, let the IDE figure out how to interpret based on its default settings, and never look back.
-
I prefer 2 spaces. Tabs are just bad, their size is hardly ever consistent between editors even with the same monospace font.
-
"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:
In theory, practice and theory are the same. In practice, they are not.
-
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.
-
I just got used to tabs (visual studio handles them really well) but spaces are fine too. I just hate how easy it is to miss spaces and then you end up with blocks of code that don't line up properly.
-
Also, some editors (for example, vim, not to name it :) allow you to display tabs, which sometimes reveals some dirty indentation (yes I'm looking at you xterm).
As for tabs vs space, for me it depends on the language: C, C++ and Java should be indented with tabs, but I would never put tabs in a python program.
That was my 0.02CAD :)
-
Us Canadians don't have pennies anymore :P
(end thread hijack)
-
I generally switch on showing whitespace in my editors. You can do it in Notepad++, and Geany. Very useful for keeping things consistent. Mismatched whitespace stands out like a sore thumb, and you just can't resist fixing it.
Lordpalandus, I think most countries these days don't use currency with denominations that small. Why is it, one of the richest countries in the world, has to count pennies?
-
I wish we'd get rid of pennies. They cost more to make than they're worth. But alas, the Zinc industry lobbies in washington. Zinc lobbyists... I want to drown myself.