Tabs VS Spaces!
Why use tabs instead of spaces ?
-
1 tab = 1 indentation .
-
Most (if not all) of editors allow visual control of how tabs are rendered.
-
Tab column indentation is dynamic. Allows collaborators to provide consistent code without sacrificing visual indentation preference.
-
Allowing preferred user rendering of the indentation with the help of tabs, will improve the user’s comprehension speed of new code.
-
Spaces take longer to maintain & more prone to errors.
Debunked Arguments
-
IDEs "treat" tabs differently . FALSE : IDEs will always treat a tab like a tab and gives the user control of the visual representation. Remember we are NOT trying to force one personal preference as a standard, so the number of columns used by the IDE to represent the tab indentation should be left up to the user. -
Other Questions
-
Why not use both tabs & spaces ? That can create an issue if contributors use different indentation methods, which could show as changes by git or other VCS. Also, combining spaces + tabs in the same file, will render things incorrectly . Imagine one function definition using tabs + spaces after setting tab width to 6 columns , thing will be out of alignment and harder to read .