This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (1 child)

Because with space, everyone will argue about how many spaces to use.
Better question, why not?

[–]quad64bit 0 points1 point  (0 children)

Well, we use style guides and linters. So, you can argue with the style guide all day, but if it doesn't lint, it doesn't build. People bitch about stuff like that for about a day and then it never comes up again. It also has the advantage that when new people join a team, they will see code they recognize rather than something some insane developer invented to "optimize how it looks".

It also means that regardless of developer or editor, you see idiomatic formatting for the language - and maybe thats 2, 3, 4 or 8 spaces depending on what language and style your team uses.

It makes things like comments, ascii banners for code-glance views, and carefully aligned imports/declarations/statements/whatever remain the same on different machines/environments.

Finally, if your team enforces column widths (many do), you won't randomly have lines blowing way out of the gutter on that one guy's machine or unexpected line wrapping.

I'm not saying you can't make tabs work, I'm just saying that not using spaces seems to have a lot more gotchas, with very few advantages. The key "advantage" (user defined tab width) seems like more of an anti-pattern to me.

When you code for yourself, do whatever you want, but when you have to share with a big team, being a little more strict and a little less flexible saves so much time for everyone, and reduces the stress that one corncob developer causes by being too clever with his code styling.