Live data from Hacker News

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

stackoverflow.blog

501–510 of 690 posts

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

#501
post #123

The reason I use tabs is pretty simple. It's faster to move around only using the keyboard. It's also faster if I'm changing code that requires reformatting. Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. Brace yourself: I use two spaces after the end of sentences too. [1] I am quite the rebel.…

You think you're a rebel? I have my tabs set to three spaces.

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

#502
post #9

Earlier quoted context omitted.

But there's an actual causation here (you need more money to buy a Tesla). Use of tabs and salary don't seem to have any relation one way or an other. My personal guess would be that using spaces is a practical decision and might be more popular towards older, more experienced devs (who are therefore better paid). On paper tabs sounds better, they're "configurable", you should indent with tabs and align with spaces,…

> My personal guess would be that using spaces is a practical decision and might be more popular towards older, more experienced devs (who are therefore better paid). They explicitly rejected this explanation after controlling for years of experience.

age != years of experience

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

#503
post #123

The reason I use tabs is pretty simple. It's faster to move around only using the keyboard. It's also faster if I'm changing code that requires reformatting. Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. Brace yourself: I use two spaces after the end of sentences too. [1] I am quite the rebel.…

You think you're a rebel? I have my tabs set to three spaces.

You must be stopped!

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

#504
post #488

Earlier quoted context omitted.

You mean something like this don't you? [tab]void some nice method(int param a, [tab] int param b So long as you only use tabs for indentation, not alignment, tabs look correct on _everyone's_ machine. The real problem with tabs is that (some) people are lazy and do stuff like this: [tab]void some nice method(int param a, [tab][tab][tab][space][space]int param b Personally, I think if you work like that you need to l…

While this is true they will look correct on everyone's machine, they'll be annoyingly wide in tools that display tabs as 8 spaces (such as less, most online diff displays, etc). But spaces will look the same regardless of tool, editor, anything.

I don't know what online diff do you use, but less let you configure the tab stop with the -x option, which is the point of using tabs: being able to chose what's more readable for you.

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

#505
post #297

Earlier quoted context omitted.

If I were the candidate I will be giving mean looks while tapping the space bar as fast as possible! Spaces FtW! Ps. On a more serious note, the editor (actually the vim plugin) takes care of this.. default is 2 spaces for ruby and 4 for python (PEP8). I like ruby more, the identation too.

rant: a default unconfigured vim instance is a perfect example of my main issue with all this whitespace crap. Personally, I like tabs, but ultimately, like you mentioned, it doesn't matter with a well set up editor. HOWEVER, a default unconfigured instance of vim is not capable of editing, for example, a YAML file in a valid manner without the user knowing that they have to manually set the tab character to spaces o…

Does anyone actually use an unconfigured instance of vim for actual development?

I can see for people sshing in, editing a file and getting back out without bothering, but you'd have to be a quite a purist to do all your development in an unconfigured Vim.

You can yank and modify existing lines which will keep your YAML spaces.

For years I never used Vim to develop full time so never invested the time to setup my vimrc file. But now that I use it for development and spent the time to set up my vimrc, it's brilliant to be able to just take the goodness with you.

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

#506

= Why Grown-Ups Don't Use Tabs = * Joe likes 4-space tabs, I like 2-space tabs, and Jane is old-school with 8-space tabs. * All goes well until someone aligns something visually, like so: void someNiceMethod( [tab][tab][tab][tab][space][space]int myParam...); * Now it aligns perfectly on my machine, looks mostly ok on Joe's machine, and is ON MARS on Jane's machine. Thus one-or-more of three futures happens: * Someon…

There's actually a solid argument for "tabs for indentation, spaces for alignment", which solves both for preference and vertically aligning stuff: [tab]void someNiceMethod( [tab][space*20]int arg1 [tab]) But it basically requires having some visual indicator of what is a tab, which most people don't like. (edited for line breaks)

If a system requires thought and care to be used properly then people will inevitably use it improperly. Even skilled, thoughtful people make mistakes or get fatigued and take shortcuts.

It seems to me that using tabs for indentation and spaces for alignment is a fragile technique. It's easy to make a mistake and not even notice. If you don't fix that mistake fast, people start to assume that maybe it's OK to ignore whitespace formatting issues. And so the problem compounds.

I would prefer to use a system that creates a "pit of success" so that even careless people have a hard time doing it wrong. I think sticking to just one whitespace character is better than mixed tabs and spaces, but best of all is using an editor that can automatically format your code.

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

#507
"Indent with tabs, align with spaces" (e.g. [1]) would be my strong preference in a perfect world. In addition to its "ethereal" benefits, some languages which support HEREDOCs have nice "tab ignoring" versions (e.g. That said, in the imperfect world we live in, I always use spaces. "Indent with tabs, align with spaces" is obviously not rocket science, but its just too opaque unless you have a strong code review process.

[1]: https://dmitryfrank.com/articles/indent_with_tabs_align_with...

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

#508
post #100

Earlier quoted context omitted.

Seems unfair to downvote you just for misunderstanding, that was sarcasm friend.

It's pretty much an unwritten rule that a sarcastic joke on the internet with sufficient exposure will get a response by someone who didn't get it. Using /s really kills the fun (and whole point) of using sarcasm so it's a trade off to accept these comments will happen. I'm impartial to downvoting as to reply literally doesn't usually add to the conversation, which is generally the point of downvoting. Losing karma s…

Yeah but we are human. Most people's feeling probably are hurt when their [non-malicious] comments are downvoted. But besides that I mostly agree with what you wrote.

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

#509

Earlier quoted context omitted.

> This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. I see this cited every time. Unfortunately, it's bogus in practice. Consider: print('some long thing', further, arguments) If this is an indented block, you'd have to indent the second line to the correct depth with tabs, then add exactly six spaces for alignment . You have to mix spaces and tabs, which is never good ne…

I'm pretty sure there's a circle of hell specifically for those who mix spaces and tabs. That being said, this problem and problems like it can be solved simply by not aligning things visually: print( 'some long thing', further, arguments ) Strictly adhering to indentation and never alignment can make the code a bit less readable, but conforming to a canonical indentation like this also makes it easier to reindent, m…

> I'm pretty sure there's a circle of hell specifically for those who mix spaces and tabs.

Could you please clarify why do you consider "tabs for indentation, spaces for alignment" such a bad practice? I have never read any argument against it.

Alignment itself can be done automatically by any editor that supports smart tabs.

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

#510

Earlier quoted context omitted.

> Don't think you make hiring decisions based on tabs vs spaces? I actually ask candidates "spaces or tabs?" in every single interview. I don't really care what the response is in regard to the holy war, and it doesn't mean anything on its own, but having SOME thought out response can be a GREAT indicator of how well versed someone is in general. e.g. I'm going to think way more highly of someone that says "tabs, bec…

Yeah, it can start some interesting conversations too - I don't care personally and tend to go with whatever autoformat in the editor uses. My view is that formatting code shouldn't be a human's job, adding linebreaks on long lines, spacing things out to exactly line up, etc is just a waste of my time. That's the computer's job - it should do it based on human readability rules though, clang-format is probably the be…

completely agree with you. and i religiously autoformat my code before i read the code and just before i save the file.

However it still amazes me how the majority of developers i work with either have no opinion on the topic or worse think this is a bad idea. some the reasons I've heard was it makes alot of changes to a file causing alot of diffs with previous version making it harder to figure was was actually changed, or they don't like they way its formatted .

Post reply on HN