Tabs vs Spaces

Everything todo with programming goes HERE.
Post Reply

Tabs or Spaces?

Tabs
8
67%
Spaces
4
33%
Mixed
0
No votes
 
Total votes: 12

User avatar
sinewav
Graphic Artist
Posts: 6334
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Tabs vs Spaces

Post by sinewav »

I use spaces exclusively, either 2 or 4 depending on the language. Lately I've been considering mixed use; tabs for the first level then spaces for each subsequent.

User avatar
LOVER$BOY
Match Winner
Posts: 725
Joined: Thu Jan 24, 2008 12:46 pm
Contact:

Re: Tabs vs Spaces

Post by LOVER$BOY »

I must admit, I use an IDE programming software (PHPStorm) to handle the tabbing. I set the settings on it to convert tabs to spaces and it works pretty good! :)
Image

User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

Re: Tabs vs Spaces

Post by Light »

Personally, I like tabs. I like to quickly use keyboard navigation when writing in close areas, so spaces are just slower. Also, if I were to use spaces, I would set the IDE to convert tabs to 4 spaces, as Lover said.

My only thing here is that I really dislike when people mix them. It's just an annoyance to me when going through and doing something. I would stick to one or the other.

As far as looks go, they're usually exactly the same. Pretty sure the common tab length is 4 spaces, so there's not going to be a difference as far as that goes. Though, I guess another up-side to using tabs would be to allow people to set their own indentation lengths.

Anyway, this is just from what I personally prefer. I don't know if there's actually a useful reason to use one or the other. Maybe tabs would keep file size a tad smaller? Not really sure.

User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1867
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Tabs vs Spaces

Post by kyle »

Depends on the language, python I'll use spaces and usually only 2, everything else I'll use a tab, which may be a tab or it might be 4 spaces depending on the ide. I don't ever mix them in the same language.
Image

chrisd
Round Winner
Posts: 314
Joined: Sat May 29, 2010 1:13 pm

Re: Tabs vs Spaces

Post by chrisd »

Tabs for indentation and spaces for alignment. That way if you change the number of spaces that is shown for a tab, it magically still looks good.

User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

Re: Tabs vs Spaces

Post by Light »

chrisd wrote:Tabs for indentation and spaces for alignment. That way if you change the number of spaces that is shown for a tab, it magically still looks good.
True, though I don't think using spaces for alignment is what he meant by mixed. I do that as well.

User avatar
sinewav
Graphic Artist
Posts: 6334
Joined: Wed Jan 23, 2008 3:37 am
Contact:

Re: Tabs vs Spaces

Post by sinewav »

I've read a bunch of the main arguments lately. Some cite file size: Tab = 1byte, 4 Spaces = 4bytes. Apparently this could be noticeable on large files (though it will never be a problem for me personally). Using Tabs let's the programmer control the look with his IDE, spaces force sameness regardless of editor.

I don't see tabs as useful for keyboard navigation since Ctrl+Arrow will get me anywhere I want to go quickly. I think my preference for spaces comes from the fact my first programming language was Python where spaces are king (first language I actually understood, that is). My boss makes me feel stupid because I use spaces, but that's probably because he makes me feel stupid about everything. He's kind of a bad boss that way.

My guess is the Tab/Space argument is only important as far as a project involving a team. I know different frameworks for the same language have different code styles. I've only glanced at the Armagetron code. Tabs there I suppose?

User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

Re: Tabs vs Spaces

Post by Light »

sinewav wrote:Tabs there I suppose?
Some of both, but for indentation, mostly / all spaces. I don't really have an argument to say they're bad, but I just prefer tabs myself. When I go to delete a single indent, it bothers me to have to count when I could hit backspace once with a tab. Since spaces are used, most IDE's that I've used will keep the style and stick to adding in spaces, which is a good thing, but I would prefer when writing that tabs are used.

epsy
Adjust Outside Corner Grinder
Posts: 2006
Joined: Tue Nov 07, 2006 6:02 pm
Location: paris
Contact:

Re: Tabs vs Spaces

Post by epsy »

Your editor can be configured to delete groups of spaces as if they were tabs. Well, mine can.

User avatar
Light
Reverse Outside Corner Grinder
Posts: 1664
Joined: Thu Oct 20, 2011 2:11 pm

Re: Tabs vs Spaces

Post by Light »

epsy wrote:Your editor can be configured to delete groups of spaces as if they were tabs. Well, mine can.
But then, what's the advantage to using spaces?

User avatar
Jonathan
A Brave Victim
Posts: 3392
Joined: Thu Feb 03, 2005 12:50 am
Location: Not really lurking anymore

Re: Tabs vs Spaces

Post by Jonathan »

I like tabs. They suit the common task of indenting by certain intervals innately. Everyone can use their preferred tab width. If I absolutely want ASCII art or something else that needs characters to line up, I'll use spaces within, although the whole thing may be indented by tabs.

Elastic tabstops are interesting.

Consistency always wins.
ˌɑrməˈɡɛˌtrɑn

Post Reply