Live data from Hacker News

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

stackoverflow.blog

101–110 of 690 posts

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

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

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.

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

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

Additionnaly diff/merge tool tend to be inconsistent. So it looks good on your editor, but when I am doing your code review, alignement is totally broken. In theory, it should be easy enough to ask people to have consistent settings across all tools, but it is a bit like herding cats. Sadly most people do not even realize it could look differently without their settings. (I could ignore whitespaces when doing reviews but this is an open invitation to break everything)

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

#103
post #62

Earlier quoted context omitted.

yeah, just because in 2017 storing source code is the most expensive thing for a company. but really, the storage is almost free nowadays...

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

I strongly think \s should be enforced in every post in HN.\s

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

#104

Earlier quoted context omitted.

In fact, tabs are better for compatibility: other people might like other indentation sizes. If you keep your stuff consistently with tabs, and use spaces for alignment instead of having your IDE auto-replace tabs there as well, your code will look great with whatever tab size someone chooses. And extra pro: in dumb editors, you automatically get the right thing.

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/django-allauth/blob/a44134688f5b...

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

#105

>Developers who use spaces make more money than those who use tabs Sure, but how many spaces? grabs popcorn

Sounds like a good time to start developing in Whitespace.

https://en.wikipedia.org/wiki/Whitespace_(programming_langua...

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

#109

Is this about whether you set your editor to convert tabs to spaces? (which is obviously tidier due to inconsistent treatment of tabs) Or do some people actually use the space bar to indent code? (which is obviously insane)

Definitely the former. Anyone who indents there code by slapping the space bar repeatedly is a monster and should have their hands cut off.

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

#110
post #83
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?

They might be configured differently, and you usually can't align stuff properly using just tabs, you have to use a space or three somewhere. Also, you never know if it's spaces, tabs or a combination of them in existing code - which you may have not written yourself. So in the long run, the indentation WILL get fucked up and you WILL miss something when fixing a bug in code that you or someone else wrote 6 months ag…

>you usually can't align stuff properly using just tabs

Huh? Things indented to 1 tab will align with everything else on 1 tab. Things aligned to 2 will align with everything else at 2 tabs.

>you have to use a space or three somewhere

Why? Tabs will indent with other tabs.

>you never know if it's spaces, tabs or a combination of them in existing code

Well they should never be combined for indentation. Unless you mean using tabs for indentation and spaces for alignment, but this wouldn't create any issues. Using tabs for spacing is objectively poor form.

I open space- and tab-indented files in my IDE, they are all converted to tabs. It is always consistent.

Post reply on HN