Live data from Hacker News

Developers who use spaces make more money than those who use tabs

stackoverflow.blog

141–150 of 690 posts

Re: Developers who use spaces make more money than those who use tabs

#143

Earlier quoted context omitted.

unless you have anything aligned in columns then all bets are off (something which many code formatters can do automatically for you e.g. lists of bindings)

Tabs for indentation; spaces for alignment; I don't know why you'd want to insert tabs in the middle of a line. Also, most people who do have several years of experience under their belt will tell you: don't align. Mid-line alignment is a waste of a maintainer's time to have to update alignment blocks every time you add/remove variables... and statement-alignment is unreadable[1]. [1] https://github.com/pennersr/djan…

I do find properly aligned code easier to read in general, I'm not willing to give that up.

The crux of the issue is poor tooling. Aligning correctly is a pain because most editors suck terribly at it. For instance neither emacs nor vim align correctly when using tabs by default (they use as many tabs as they can and then pad using spaces, instead of indenting only with tabs and aligning only with spaces). If they did it would be painless to indent and re-indent.

When some of the most venerable code editors out there can't even seem to get it right I think there's no point in fighting it. Learn to stop worrying and love the space, I know I did. Or alternatively use a language like go which provides a standard tool to indent everything, make it mandatory pre-commit and never look back.

Re: Developers who use spaces make more money than those who use tabs

#144

Earlier quoted context omitted.

unless you have anything aligned in columns then all bets are off (something which many code formatters can do automatically for you e.g. lists of bindings)

Tabs for indentation; spaces for alignment; I don't know why you'd want to insert tabs in the middle of a line. Also, most people who do have several years of experience under their belt will tell you: don't align. Mid-line alignment is a waste of a maintainer's time to have to update alignment blocks every time you add/remove variables... and statement-alignment is unreadable[1]. [1] https://github.com/pennersr/djan…

> Tabs for indentation; spaces for alignment;

If you try this, it fails for people who use a different tab size than you, which is the whole supposed point of using tabs.

But yes, the correct answer is don't align. Utter waste of time.

Re: Developers who use spaces make more money than those who use tabs

#145
post #61

Pretty simple: you use spaces because you're aware that there is more than one IDE/editor in this world and who knows what your code will get opened with tomorrow. This means you consider consequences beyond "but it works on my machine" so you're a better programmer. Ergo, higher salary.

Almost everyone I know who uses spaces or tabs does so because that's either the default on their IDE, or for their language. So this holier-than-thou argument holds less water than the sun. On the other hand, I find 2-space-indented code unreadable; in fact, 4-space wide indentation is the only size I find to be readable. I know plenty of people for whom that isn't the case. Using tabs lets the reader set the indent…

Actually they all boil down to 'someone else, or another IDE that you haven't configured just right, will mess your tabs and make the code hard to read' :)

They're fine for solo projects i guess, if you only ever use one editor.

Edit: Also, in the long run the best thing you can do to your code is to make it easily readable. You will forget what you did. Not to mention your colleagues that have never seen it. So time spent aligning parameters to make code more readable is well spent, if you ask me.

Re: Developers who use spaces make more money than those who use tabs

#147
post #73

A possibility I haven't seen mentioned is that the style guide of their employer, together with a few employers who pay out-sized salaries (Google, Amazon, Facebook...) could account for the difference.

Yes, the only reason to use spaces is because you are forced to because you work in an organisation that had to force this rule because it employs too many morons who cannot make the difference between indentation and alignment.

* Large organisation -> pays more.

* Organisation that has power to enforce coding style rules -> pays more.

* Morons -> they are paid more.

Re: Developers who use spaces make more money than those who use tabs

#148

On a somewhat related note, if I had to ask a Genie for a wish, I'd ask him to magically convert all tabs in all codebases to spaces and make git forget the commit.

Apart from the fact that you are doing it the wrong way around, that would actually be a really useful git command.

I.e. you fix the whitespace in your files, then rewrite history as if it was always that way. Then you don't get git blame showing you whitespace-only commits.

(Yes I know there is an option to ignore whitespace in git blame, but it isn't on by default so it is useless everywhere except the command line.)

Re: Developers who use spaces make more money than those who use tabs

#149
If you're in the JS world check out https://github.com/prettier/prettier if you haven't. It's used by some big projects like React, Babel, webpack etc.

Unlike "traditional" formatters, it parses your code into a syntax tree completely disregarding any original formatting, meaning the output is entirely consistent. It's pretty liberating to devote zero time to manually formatting and can make code reviews more constructive and less superficial. It is what is is, and it's pretty opinionated based on Facebook's code style. Works great for us, enforced with a git hook.

Re: Developers who use spaces make more money than those who use tabs

#150
post #70

Earlier quoted context omitted.

I think there's probably some truth to considering existing norms and thinking ahead, but find it unlikely to be the main confounder. How do tabs fail to work in other editors/IDEs?

Tabs fail when my IDE is set to convert tabs to spaces and yours isn't.

Spaces when tabs are used. Your point?
Post reply on HN