News for hackers. Stuff that matters.
Re:Stack Overflow Developer Survey Results 2017 by flurdy on Wednesday March 22, 2017 @08:55AM (#13930474)
Re:Stack Overflow Developer Survey Results 2017 by Pharylon on Wednesday March 22, 2017 @10:42AM (#13931299)
I use spaces exclusively, but only because everyone else does. Tabs are clearly superior, since their width can be adjusted to look however you like. For instance, I prefer 4 spaces of indentation in Javascript. Another developer here prefers 2. With tabs, we could both be happy.
Re:Stack Overflow Developer Survey Results 2017 by darth_mastah on Wednesday March 22, 2017 @11:58AM (#13931960)
Oh, those memories... That's exactly what I thought a convincing argument when I was taking my first steps in development. Everyone can make the code look as they want! But wait... Why would everyone want the code to have different visual indentation? I fail to see the benefit in that. The so called "personal preference" is a hoax. After having given up on tabs I used to think 4 spaces are so amazingly cool, 2 spaces are weird. And then standard came along and finally brought consistency. Of course, they couldn't get it right, and abandoned semicolons, which is why there is also semistandard. Ask Douglas Crockford why you should have semicolons in your code. There is a good reason for that, not based on anyone's "personal preference".

The tabs vs 4 spaces vs 2 spaces is not the whole story, oh no. It is merely the beginning. There are many other life threatening problems to solve. Where to put the brackets? Multiple var statement or just one? Space between function name and brackets or no? The list just goes on. You keep thinking what is better. There is no clear answer, one choice is no better than the other but you have to make up your mind. You have to make the decision and stick to it, because code should be consistently formatted. And when you finally decide, it becomes part of you, part of your identity. "I am the guy who has just one var statement! I am the guy who does not bother with a space between function name and the bracket!" Yeah, you're such a cool, original rebel, you are. And if someone tries to take it away from you you get really angry. It is a bit like religion. On some level we know it does not really make sense, but all the same we believe in it because it defines who we are.

Douglas is right, you know. We, devs, are not as rational and logic driven as we think we are. We are very irrational and emotions driven, maybe even more than other people around us. 2 spaces in the way of your happiness. Bah!

Re:Stack Overflow Developer Survey Results 2017 by strictnein on Wednesday March 22, 2017 @11:23AM (#13931640)
Yeah, this is the argument that I make as well, and I don't understand why it doesn't just settle the debate. With tabs, everyone can have their code look however they want it to look, even the weirdos who want it to be 8 spaces.
Re:Stack Overflow Developer Survey Results 2017 by m0sa on Wednesday March 22, 2017 @09:19AM (#13930639)
The problematic ones are the 19.3% who prefer both...
Re:Stack Overflow Developer Survey Results 2017 by flurdy on Wednesday March 22, 2017 @09:47AM (#13930820)
Re:Stack Overflow Developer Survey Results 2017 by Ajedi32 on Wednesday March 22, 2017 @11:21AM (#13931626)
Tabs for indentation, spaces for alignment. That way devs can set whatever tab length they prefer in their editors without messing up alignment.
Re:Stack Overflow Developer Survey Results 2017 by kbart on Wednesday March 22, 2017 @09:36AM (#13930744)
I choose between tabs and spaces depending on existing code base, but prefer neither (or both). When writing code from scratch, it depends on language and text editor used.
Re:Stack Overflow Developer Survey Results 2017 by marcosdumay on Wednesday March 22, 2017 @10:23AM (#13931109)
It1s a safe question to estimate the troll numbers.
Re:Stack Overflow Developer Survey Results 2017 by parroquiano on Wednesday March 22, 2017 @09:37AM (#13930745)
On the contrary, those of us who prefer both are the smart ones[0]

[0] https://www.emacswiki.org/emacs/SmartTabs

Re:Stack Overflow Developer Survey Results 2017 by rejschaap on Wednesday March 22, 2017 @11:01AM (#13931458)
That's too complicated for the unwashed masses
Re:Stack Overflow Developer Survey Results 2017 by serg_chernata on Wednesday March 22, 2017 @09:00AM (#13930514)
Tabs are far superior. :)
Re:Stack Overflow Developer Survey Results 2017 by tannhaeuser on Wednesday March 22, 2017 @10:15AM (#13931041)
This is the correct answer.

The bad developer is identified by the rhythmic noise of arrow keys.

Re:Stack Overflow Developer Survey Results 2017 by yosamino on Wednesday March 22, 2017 @10:47AM (#13931350)
... because they aren't using an editor coughvimcough that correctly positions their cursor automatically or let's them jump to the beginning of a line with a single keystroke ?
Re:Stack Overflow Developer Survey Results 2017 by mbel on Wednesday March 22, 2017 @10:46AM (#13931340)
How arrow keys are related to tab/space flamewar? Isn't everybody (whose job requires typing) using moving between words as the most basic mean of navigation? (w, M-f, Ctrl+arrow, etc.)
Re:Stack Overflow Developer Survey Results 2017 by TorKlingberg on Wednesday March 22, 2017 @09:39AM (#13930762)
Yes, strange, I rarely encounter codebases with tabs. I wonder if some of them mean they press the tab key and the editor adds spaces.
Re:Stack Overflow Developer Survey Results 2017 by OJFord on Wednesday March 22, 2017 @10:05AM (#13930968)
> strange, I rarely encounter codebases with tabs

I prefer tabs, but I never use them.

It's like social networks, it doesn't matter what you prefer, it matters what your friends prefer. If 57% prefer spaces, well okay I suppose we're using spaces then.

Re:Stack Overflow Developer Survey Results 2017 by wtetzner on Wednesday March 22, 2017 @11:05AM (#13931492)
I think the problem with tabs is that you inevitably end up using both tabs and spaces. This still OK, as long as tabs are used for indentation, and spaces for alignment. But if you don't have good editor support for it, you'll end up with some lines indented using tabs, and some indented using spaces.

So while in theory tabs are superior, in practice they seem to end up being more trouble that they're worth.

Re:Stack Overflow Developer Survey Results 2017 by scrollaway on Thursday March 23, 2017 @04:29AM (#13938143)
I've been using tabs in Python for 14 years and I haven't needed to align anything in 13. Join me, it's a wonderful, readable world out there.

Indent level alignment is far less readable than just indenting one extra for new context. As for inline alignment, I found its super counterproductive due to diff noises every time you update the members.