Programming     ::    Surprise me!    |    <- Next topic >
 

Spaces or Tabs?
(public topic in Programming)

Avatar Image   Started by Avatar Avatar has 10,447 Grupie Points 2 years ago         Comments 5 Comments

Jamsterson mentioned the ongoing argument of tabs vs spaces in the grupthink blog ( http://blog.grupthink.com/?p=32 ). Do you like to use tabs or spaces to indent your code?

Tags: programming, tabs vs spaces

 
       
Page 1 of 1
1.  

Tabs

Leader! Most 1st Place Votes
Tabs allow the next guy down the road to configure how much whitespace the tabs actually create. If they like the equivalent of 6... [show more]

Comments Add a comment

 
16  votes
2.  

Spaces

Spaces are more fliexible than tabs and allow one to place code exactly where one wants it.

Comments 1 Comment

 
6  votes
3.  

Tabs and Spaces

This is really nasty to do to the programmer that comes behind you. :)

Comments 2 Comments

 
1  votes
 
Page 1 of 1

Comments

Avatar Image
      Thumbs down Thumbs up   
uewebawo 2 years ago

For me, it entirely depends on the language whether I use spaces or tabs. For example: I usually use tabs for C/C++ and Java, but I usually use spaces for Lisp and Prolog.

Reply    Link to this comment Link
Avatar Image
      Thumbs down Thumbs up   
hajush 2 years ago

This comment is primarily relevant for Java. For some reason, Sun standardized on 8 spaces per tab, but most IDE's come up with 4 spaces per tab by default, and since the indentation base is 4 spaces, that makes more sense for Java. This mishmash means that if you're debugging and you need to look at some Sun Java code, and you're settings are at 4 spaces per tab, everything goes nasty.

It's easier to avoid this entirely just by leaving the settings at 8 spaces per tab, and getting everyone in the team to use spaces to avoid this issue.

Reply    Link to this comment Link
Avatar Image
   +1  Thumbs down Thumbs up   
BitDrifter 2 years ago

PEAR for PHP also insists on Spaces and not tabs:

From their Manual:
"Using spaces and avoiding tabs is the only way to ensure that a piece of code is rendered consistently in all editors and viewers. Many editors render tabs as 4 spaces, and a lot of editors, terminal programs and utilities render tabs as 8 spaces."

" In a community like PEAR where people use lots of different systems and editors, using tabs simply doesn't work. People will end up doing whitespace commits fixing rendering in their editor, while breaking it for others. With only spaces it will look the same to everyone."

Reply    Link to this comment Link
Avatar Image
      Thumbs down Thumbs up   
BitDrifter 2 years ago

Oops forgot the link:
http://pear.php.net/...vs-spaces.php

Reply    Link to this comment Link
Avatar Image
      Thumbs down Thumbs up   
ngsun 2 years ago

Tabs are the only way to go for any C/Java-style language. It isn't the distance that's important, it's the RELATIVE distance. And trying to copy/cut+paste code is a frigging pain in the butt with spaces... And if you end up having to enclose something inside another control structure, or take it out of one... ugh... just ugly.
Since they're neater, functionally superior, and quicker, tabs are definitely the way to go. :)

Reply    Link to this comment Link

Topic Details

This topic was started by Avatar Avatar has 10,447 Grupie Points on August 13th, 2006. 22 grupies have voted on one or more of the 3 answers.

Tags: programming, tabs vs spaces

Please login or register to see other notification options.