3 ms·
I've always used spaces instead of tabs. My rationale: The number of readers of any document will normally be greater than the number of authors. We should gi
by w_t_payne 10y ago
I've always used spaces instead of tabs.
My rationale:
The number of readers of any document will normally be greater than the number of authors. We should give a slight preference for readability and ease of comprehension over writeability, and should certainly not require that our readers adjust their editor settings for each document that they peruse.
In addition, it is useful to use vertical alignment to group related content that spans multiple lines. Although this at least partly an aesthetic choice, and not without drawbacks, I believe that the benefits outweigh the costs.
I believe that it looks neater, improves readability and also makes some errors "pop" out in a way that they don't in unaligned content. I find the ability to visually group related terms and expressions particularly useful.
The downside is that you have to "tidy up" after using refactoring tools or after doing a search-and-replace operation.
However, I believe that this downside is mitigated due to the fact that the very tidying up that is required is a good way of eyeballing the changes and checking to make sure that they are OK.
http://williamtpayne.blogspot.co.uk/2012/04/spaces-over-tabs.html http://williamtpayne.blogspot.co.uk/2012/04/spaces-over-tabs...
- scrollaway 10y agoHey, a rationale, something I seldom see in those debates :) I think that if you do want to align, spaces are unavoidable. But I want to reiterate three points against alignment: - Alignment creates a maintenance burden. It has to be updated whenever you touch unrelated lines, which creates whitespace noise. - Some types of alignments (specifically, method parameter alignment) create extreme horizontal noise. See for yourself: https://github.com/pennersr/django-allauth/blob/c9b31ddee81d2cde06c1f686c4eb7703f916681f/allauth/account/views.py#L629-L632 https://github.com/pennersr/django-allauth/blob/c9b31ddee81d... That stuff's ridiculous. Styleguides are meant to make the code more readable and maintainable - this is neither. Method calls can be defined just like arrays, where the first argument goes on a newline with a single added indent. No need to align anything. - Finally, alignment breaks with proportional fonts. This is something someone else brought up on HN in another topic and I think it's a really good point; proportional fonts, like tabs, are an accessibility feature.
- patrickmay 10y ago> - Some types of alignments (specifically, method parameter alignment) create extreme horizontal noise. See for yourself: https://github.com/pennersr/django-allauth/blob/c9b31ddee81d.. https://github.com/pennersr/django-allauth/blob/c9b31ddee81d.... The answer there would be to put the line break before the . and align the .dispatch under super.