Live data from Hacker News

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

stackoverflow.blog

531–540 of 690 posts

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

#531
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.

Some typefaces have spaces as narrow as 1/5em. Many are around 1/4em.

Spaces in a fixed width typeface will be up to about 5 times as wide as in some proportional width ones.

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

#532

Earlier quoted context omitted.

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 chan…

I've been following this practice for a while, but never really thought much of mentioning it until I watched an interesting talk the other day:

https://channel9.msdn.com/Events/GoingNative/2013/The-Care-a...

In it, they mention an autoformatter as one of the best tools they gave their developers in terms of productivity gain and it really got me thinking about how this should be versus how it is in practice. There are some really bad autoformatters and some really good ones - find one that works and is configurable to match your standard and I think it really does result in a good productivity improvement.

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

#533
post #415

Earlier quoted context omitted.

So for long lines to move an argument over to align with its predecessor on the previous line, like int f() { int someVariableName = myFunctionCall(expr(5), // ...you're saying line A is indented with tabs, and line B with spaces? Because that will misalign if your tab setting isn't the same. Or are you saying that both A and B are indented with spaces? Then what about line C, which will misalign with A and B if your…

A is indented with a tab. B is indented with a tab, plus the requisite number of spaces to line up with the above line. C is indented with a tab.

Does anyone actually do that? I've never noticed that style in any code I've read, but maybe that just means it works.

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

#534

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…

Wait ... you're saying that you should do a tab, and then a whole bunch of spaces? What actual benefit does tabbing even get you at that point?

Formatting

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

#535

Earlier quoted context omitted.

That's the reason I use tabs for indentation? 4 spaces will render as 4 spaces, 2 as 2. 1 tab will render to whatever the next programmer prefers, it's only courteous.

It's courteous except to those that don't like tabs, so you really can't win. Many languages have a coding style preference. Go is super opinionated, Python in the middle, with C being as conflicted as it gets. Whatever you use, follow the style the language or team is a proponent of.

Picking one or the other will be slightly discourteous to the other side, in this case this is an advantage only tabs hold.

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

#537
post #498

Earlier quoted context omitted.

They explicitly rejected this explanation after controlling for years of experience.

age != years of experience

That statement is correct, yet the commenter mentioned two variables who are caused by years of experience and are only correlated with age.

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

#539
post #504
post #488

Earlier quoted context omitted.

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.

The point of using spaces is to not worry about any of this. You need a specific fix for less, another specific fix for other diff tools, etc etc. With spaces, everything just works.

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

#540

Earlier quoted context omitted.

> 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. This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. People who use spaces want to line up their '=' signs, that's fine, but I don't believe it's my position to enforce the amount of whitespace another…

> 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 wonder how much time have been wasted trying to make margins and columns look good with a proportional (non-monospace) font ...
Post reply on HN