4 ms·
Right, having tabs seems better since I can configure my editor to display tabs as 4 spaces, while whoever else can have tabs be displayed as 8 spaces. Having s
by Dewie 12y ago
Right, having tabs seems better since I can configure my editor to display tabs as 4 spaces, while whoever else can have tabs be displayed as 8 spaces. Having spaces instead, and having to make your tabs output spaces, and perhaps also backspace deleting four spaces (a "tab") in certain contexts, seems pretty complex in comparison.
- twic 12y agoAgreed. Using spaces to painstakingly emulate tabs, rather than just using tabs, seems absurd to me. Even better, if you use real tabs, you might be able to use elastic tabstops: http://nickgravgaard.com/elastictabstops/ http://nickgravgaard.com/elastictabstops/
- oneeyedpigeon 12y agoAgreed, although this doesn't sit well with me when combined with the reasons for the recommendation - i.e. 8 is just better, line length should be 80, nesting should be limited to 3. If someone can set their indent level to something other than 8, won't they be more likely to violate other rules? I say this having just realised I have my tab set to 4 spaces ...
- dezgeg 12y agoIn theory, it sounds like a nice idea that by having tabs, you could choose your own preferred indent width of something different than 8 columns. But in practice, this will cause problems, such as code written by you going over the maximum line length when viewed by people with 8 column tabs.
- Dewie 12y agoMy editor is set to wrap around on long lines... but that is again of course another thing that potentially has to be tweaked. That is something that is done when writing normal text (like in this text box here on this website), and is done in word processors, so it feels pretty natural. Though I've used that (wrapping around) mostly when writing in Haskell, for some reason. In Java and whatever lines tend to not become too long, perhaps because I tend to use four space indent...
- scrollaway 12y agoI got into that fight so many times. It baffles me a majority of programmers out there do not understand that tabs are not just a matter of preference, they are a matter of accessibility. I read better on 4-char indent, and some people read better on 8-char indent. Let the user choose, rather than force it with spaces.
- coldpie 12y agoI don't care much either way so long as you NEVER VERTICALLY-ALIGN YOUR LINES. int valueone = 1; int anothervalue = 2; float yetmore = 3.; Aggggh what a waste of time why do people do this
- Zardoz84 12y agobut looks nice....
- edent 12y agoBecause I find it really handy to quickly, and visually, check the sanity / logic of something. In your example, it's really easy to run your eyes down a column and see that one of those values is radically different from the others. As a trivial example: int robert_age = 32; int annalouise_age = 25; int bob_age = 250; int dorothy_age = 56; I find easier to read as: int robert_age = 32; int annalouise_age = 25; int bob_age = 250; int dorothy_age = 56; Coding styles are about readability and usability. The columns metaphor works well for some categories of data - that's why spreadsheets are so popular.
- andreasvc 12y agoThis ruins the readability and usability of your diffs. Say you need to quickly track down a major bug due to a change in a single constant. With horizontal alignment, the diff might contain any number of changed lines, obscuring the crucial change. There are workarounds that ignore whitespace and word-based diffs, but it's just not worth the trouble IMHO.