8 ms·
Correlation != causation Spaces are simply inferior to tabs since the latter conveys the meaning of "one level of indentation" while the former does not. It's
by jdrek1 4y ago
Correlation != causation
Spaces are simply inferior to tabs since the latter conveys the meaning of "one level of indentation" while the former does not. It's also better for accessibility and file size. There is not one single logical reason to ever use spaces for indentation, not one.
For some very fucking stupid historical reason someone in the 80s made the idiotic decision of spaces being the default in editors and people just went with it. The people earning more are doing so because those are the seniors who have given up on common sense and just go with the flow of the masses who are unable to grasp "tabs for indentation, spaces for alignment" yet insist on keeping alignment so the (terrible) compromise is just using spaces. And I strongly question whether "alignment" is worth anything, in almost all cases it's just useless and in the rest you're drawing ASCII diagrams in the comments which doesn't affect your code at all.
Also see the top answer at https://www.reddit.com/r/programming/comments/8tyg4l/why_do_developers_who_use_spaces_make_more_money/ https://www.reddit.com/r/programming/comments/8tyg4l/why_do_...
- jsyolo 4y agoWhat's the difference between indentation and alignment?
- usrusr 4y agoAlingment is leading whitespace that is expected to match the width of some non-whitespace text above, indentation is leading whitespace that is just expected to match all other indentations (* level). When indentation is scaled through editor reconfiguration, alignment should stay the same. What I think gp is underestimating is just how much alignment there was in the old days, and how little (compared to now) indentation. From today's perspective, indentation is the norm and alignment is the rare exception. Your question is a good illustration: sounds like you never met alignment, or at least never noticed it. But back then, alignment was a very regular occurrence and the extra diligence required for getting all the tabs and blanks right to look nice on different tab widths, or the ugliness from failing to get the mix right would have been a considerable cost. Avoiding unpredictably wide tabs was a reasonable call.
- jcparkyn 4y ago> Tabs are simply inferior to spaces... I think you wrote this the wrong way around?
- jdrek1 4y agoUps, yes. I had it switched originally but then for some reason switched it again. Apparently commenting late at night is not a good idea.
- ddoolin 4y agoTabs are denoted by arrows and I don't like being told what to do! :)
- CoastalCoder 4y agoThe arrows are not instructions. They're the LHS attacking the RHS. Code is war.
- camjohnson26 4y agoEnglish is a bad convention too but we use it because humans don’t need the theoretically best systems to be productive, they need something good enough. Spaces are good enough, tabs are good enough, and anybody who gets emotionally invested in one vs. the other is wasting time.
- lmohseni 4y agoAlso for blind programmers, tabs are much nicer for a screen reader.
- CodeWriter23 4y agoTestimonial: I experienced a significant increase in earnings about 4 months after abandoning tabs for spaces. Cause not known but that’s what happened.
- deleted 4y ago[deleted]
- gchamonlive 4y agoSpaces define by themselves the spacing convention unambiguously, whereas tabs is environment dependent and need other tools like editorconfig to guarantee consistency
- ahungry 4y agoWell stated.
- 3836293648 4y agoNo, it's incredibly stupid and is missing the point. You use tabs to not be consistent. So that the crazy js person can have a 2-wide indent and the slightly visually impaired person can have an 8-wide indent without reformatting the entire codebase
- gchamonlive 4y agoAre you visually impaired of have you received or read criticisms of this nature from visually impaired persons? Genuine curiosity, because if this is a matter of accessibility I would vouch for tabs. Thing is that with spaces you can also predict consistently the line length and not have code being clipped on someone's screen that set tabs for 8 spaces for some reason. In any case, I like spaces but I am impartial to either one. You seem like you have very strong opinions about the matter so I won't push the subject further.
- dotancohen 4y ago> Thing is that with spaces you can also predict consistently the line length and not > have code being clipped on someone's screen that set tabs for 8 spaces for some reason. Spaces force you to worry how that other dev will see the code. Tabs are semantic - you set the editor to display how _you_ like to see it and that other dev sets the editor to display how he likes to see it.
- 3836293648 4y agoI've recieved. But I'm also the crazy person who uses an 8 wide indent anyway
- wruza 4y agoThe decision to use a character that is 8 chars wide for indentation of a highly nested code was not a brightest idea either. I’d love to set up terminal tabstop size, textview tabstop size, github tabstop size, IM tabstop size, HN tabstop size, git gui plugin tabstop size, issue tracker tabstop size, tsv file format tabstop size if I used tabs. It makes you so productive.