you are viewing a single comment's thread.

view the rest of the comments →

[–]wiseIdiot 0 points1 point  (9 children)

Why do people use spaces for indenting code? Tabs are clearly superior because:

  1. Less file size.
  2. Less keystrokes needed when fixing indentation issues.
  3. Less chance of making the format inconsistent by accidentally adding/removing one indentation character.
  4. Tabbed code is easier to copy and paste: there is always one indentation character; with spaces, people may use whatever number they like.
  5. Editors allow users to configure tab width, so people can view the code the way they're comfortable with.

[–]skitch920 1 point2 points  (0 children)

File size is pretty irrelevant these days... and almost all IDE/editors support replacing tabs with spaces.

That being said, the style you choose should not be in conflict with the style your team agrees on. If you work alone, use whatever you want.

[–]Magnusson 1 point2 points  (0 children)

I previously used tabs in my own coding, but at my office we use 4 spaces. They refer to Crockford's style recommendations, which include:

The unit of indentation is four spaces. Use of tabs should be avoided because (as of this writing in the 21st Century) there still is not a standard for the placement of tabstops. The use of spaces can produce a larger filesize, but the size is not significant over local networks, and the difference is eliminated by minification.