An attempt to summarize all the arguments around tabs vs. spaces.
- Each developer can pick their tab size - if one dev likes 4-column tabs and the other likes 2-column tabs, they are both happy.
- counter: really?
- counter to counter: yes
- counter: really?
- Fewer characters in the code. This matters more for things that go over the wire (HTML, XML).
- counter: if you really care, you'll minify anyways. This is pretty trivial.
- It is easier to type and erase when using a tool that doesn't insert spaces when you press the tab key or delete them when you hit backspace.
- counter: when are you writing non-throwaway code with such a tool?
- A lot of utilities will display tabs as 8 columns, which pushes code far to the right, and that can be awkward. You don't always have control over these utilities' settings or want to waste time changing them (e.g., troubleshooting something on a server). Examples: github, opengrok, Notepad, vi, pico,
<pre>
tags in browsers. - Viewing in a tab-size other than the one the code was written in will disrupt any vertical alignment made in the code: http://jarrodoverson.com/blog/spaces-vs-tabs/
- counter: many (most?) coding standards discourage this sort of alignment anyways.
- counter to counter: try coding in a LISP language without this. This would suck with tabs: https://github.com/ctford/goldberg/blob/master/src/goldberg/variations/canone_alla_quarta.clj#L116
- counter: if you specify the tab-width in your coding styleguide, you can keep the alignment when using tabs
- counter to counter: But then you lose a key benefit of tabs, and it will suck in any tool that doesn't understand your coding styleguide (e.g., GitHub, Notepad).
- counter: many (most?) coding standards discourage this sort of alignment anyways.
- You can't have a coding convention that has different levels of indentation for different contexts unless you use lots of tabs:
- counter: why would you do this?
public static void main(String args[]) {
LOGGER.info("This is a string that needs to be brokenfor readability, but our standards " +
"say to indent by 6 spaces, halfway between 1 and 2 tabs in a 4-space world.");
}