Tab vs Spaces

What is your identation method?


  • Total voters
    23

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,485
Reaction score
973
Got my pastebin link DELETED by moderation because I should use "code" BB code instead. I actually tried it, but since it replaced my tabs for spaces and pastebin raw link kept my tabs, I went for pastebin. Than wild @Rexxar appears telling me spaces are industry standard, and @ochmar come up with some PEPthing excuse about space superiority.

I did some research and...

Developers Who Use Spaces Make More Money

Its still seems to be split 50%-50% usage though.


Still, I don't care, tabs = less key strokes + precision. Please share your thoughts.

#TABIDENTATIONMASTERRACE
 

ochmar

Active Member
Joined
Feb 27, 2016
Messages
203
Reaction score
111
Just to clarify, because you put that in context as is I was against tabs.
I am not. I use tabs myself because for me it's simpler and easier. But I also use environment that translates my tabs into spaces. And I think that everyone, or at least most of us, should adapt to this tyle.

If smart guys are telling me that spaces are allowed and tabs are not, then I do follow that rule, because I am no smart guy myself.

Still, I think that post deletion because of pastebin is a little too far.
 
OP
Peonso

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,485
Reaction score
973
Just to clarify, because you put that in context as is I was against tabs.
I am not. I use tabs myself because for me it's simpler and easier. But I also use environment that translates my tabs into spaces. And I think that everyone, or at least most of us, should adapt to this tyle.

If smart guys are telling me that spaces are allowed and tabs are not, then I do follow that rule, because I am no smart guy myself.

Still, I think that post deletion because of pastebin is a little too far.
Mod deleted the link, but edited the post to contain BB code with the content.

5 columns of identation, 5 tabs, 20 spaces (most of the time), are they really that smart??
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,456
Reaction score
802
Location
Proland
I use tabs myself because for me it's simpler and easier. But I also use environment that translates my tabs into spaces.
Then you don't quite use TABs. It doesn't matter that you use the TAB key. I do too - I never press spacebar 4 times. But I also never actually write TABs to the file.

Still, I think that post deletion because of pastebin is a little too far.
Post was not deleted. It was edited to include the content in the post. It wasn't even too long. That has two advantage:
  • You don't need to visit a separate site to see the code
  • It won't expire or be deleted like most external resources eventually are (pastebins included if they expire)
 
Last edited:

ochmar

Active Member
Joined
Feb 27, 2016
Messages
203
Reaction score
111
Then you don't quite use spaces. It doesn't matter that you use the TAB key. I do too - I never press spacebar 4 times. But I also never actually write TABs to the file.
Either I don't fully understand, or you're missing the point. If I click the tab, but all the file received is 4 spaces, does it matter at all?
A file does not see my tabulator sign even for a split of the second. So how does that counts as "Then you don't quite use spaces." as I clearly do? Doesn't matter which button I press, my keyboard output matters. I can even bind my "space" to F1 key, what's the difference?
Post was not deleted. It was edited to include the content in the post. It wasn't even too long. That has two advantage:
  • You don't need to visit a separate site to see the code
  • It won't expire or be deleted like most external resources eventually are (pastebins included if they expire)
Ah. Totally my bad. Got it all wrong, then.
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,456
Reaction score
802
Location
Proland
Because all the programming languages I use have some sort of standards to use spaces. And the ones that don't have a clear standard, I still use spaces. Because spaces typically have known width on the screen, while tabs vary.
Either I don't fully understand, or you're missing the point.
I edited my post. I meant to say you don't quite use TABs. We're on the same page here. Sorry for the confusion.
 

Apollos

Dude who does stuff
Joined
Apr 22, 2009
Messages
583
Reaction score
354
Location
United States
The tab button was made for indentation. Spaces can get ugly and they're a pain to work with, especially when you have to delete portions.
 

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,456
Reaction score
802
Location
Proland
Actually, I just realized I was using tabs in Go, just because my IDE automatically uses whatever is the standard for the language.

Here are some interesting per-language stats: Tabs or Spaces (https://ukupat.github.io/tabs-or-spaces/)

Go specifically makes it a standard to use TABs (via go fmt). Anybody using a modern IDE will use TAB on the keyboard and then whatever is configured for the language in actual files. Unless you use vim only.
 

Rexxar

of Unimatrix Zero-One
Joined
Jun 4, 2009
Messages
872
Reaction score
34
Location
Narnia
Anybody using a modern IDE will use TAB on the keyboard and then whatever is configured for the language in actual files.
Can confirm this. At least Visual Studio, anything from Jetbrains (Intellij, Clion, etc) and Netbeans, as well as editors like VSCode, Atom and Sublime Text come preconfigured to replace tabs with spaces.

You press tab and it skips forward like you would have pressed tab, but what it actually does is place in 4 (or more) spaces, and if you press backspace while at the end of one of those "fake tabs", it deletes 4 spaces. So you don't notice anything, while coding standard is maintained.

Than wild @Rexxar appears telling me spaces are industry standard
Yes, it is a coding standard because a lot of the time tabs behave differently across different platforms, which means code that looks good to one person, could look like shite to someone else, either because there's too much indentation, or too little.
And then we're not even mentioning all the issues with sending said code from one person to another, because A LOT of websites (and otherwise) outright ignore or actively strip \t characters from text because they mess with formatting so much.

Linux, the largest and most well known software product in all of history, has standardized to use spaces instead of tabs in its code;

Linux kernel coding style — The Linux Kernel documentation (https://www.kernel.org/doc/html/v4.11/process/coding-style.html)

Same goes for Python, C# and Java, three of the biggest languages in the world. Their coding standard calls for spaces instead of tabs.
Even Google, the biggest company on the planet, recommends (and enforces internally) spaces instead of tabs in C++ as well as everything else.

So yeah, your #TABIDENTATIONMASTERRACE movement is going to be meeting heavy resistance, just sayin'.
 

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,819
Reaction score
166
Location
Texas
Tabs aren't universal. Spaces are.
The editor handles everything, just set it to use spaces and forget.
 
Top