Now for one of the more ridiculous debates of our day. But, just like any other, it has its share of zealots. As it will not make any sense to the average daylight dweller with a social life, it needs a little explanation.
Programmers are a different bunch. A lot of them are perfectionists, most of them are lazy and a lot of them are stubborn. Well, at least I have a mix of these qualities. Anyways, a lot of these people have set ways about "clean" code, "elegant" solutions and the best way to do things. Most of the internet is text created by these assholes ranting at each other, this article being a nice example of such bullshit.
If you work in the software industry, you will probably have to collaborate on a project. That means working with other people. (social interaction, AHHHHH!) If you're using any mainstream programming language, this collaboration will inevitably have to arrive at an answer to the simple question: tabs or spaces?
It is much akin to the grocery clerk query, "paper or plastic?". Either option acheives the exact same goal, and it is hard to tell which is better because both appear to solve the problem to satisfaction. So what the hell are we talking about with tabs or spaces? Well, in code, a lot of indentation is used. These indents are usually done with tabs or four spaces. In most languages it is merely to make the code look better. These languages usually use { and } to encase blocks of statements.
But in a few languages, like Python, indentation is everything. It uses indentation to tell which statements belong to what class, structure or function, etc. Immediately I thought AWESOME, no more typing { }! Yes, its a cool idea. Yes, I'm trying to save time by not requiring myself to write braces. Yes, I am that lazy. Yes. Yes yes yes.
Here's an example because examples are fun:
Legit C Code
if( something == somethingElse ) {
something=somethingElse + 1;
}
|
Legit Python code - less BS!if something == somethingElse : something = somethingElse + 1 |
So after getting all excited about how COOL my life would be void of curly braces, I downloaded Python and some example code. The best way to learn any language, in real life or computer land, is to get drunk, try it out and see if you don't get killed.
Well, I was killed on the first attempt, by the same indentation rules that I was so attracted to. It turns out, my code didnt run because I mixed indentation with four spaces and tabs. The person who originally wrote the code used spaces to make the lines move over, whereas I was inserting tab characters to indent my code. This finally brings us to the big idea.
See, people that indent with spaces are fascists. Or communists. Or Fascommies. The only real reason people indent with four spaces is because the code will look pretty much the same in every editor. Stupid editors like Notepad tend to do stupid things with real tab characters - just switch your editor to something worthy of being called an editor. If you really want to force people to have to indent with a certain number of lame spaces, fine, be like that, Adolf.
If Joe Schmo decides to indent all his code in 3 spaces, he forces everyone else to either use 3 space tabs or go insane reading incoherent code. An indent could be anywhere from 2 to 6 spaces, depending on the nutbar you're talking to.
Don't get it yet? Here's a bulleted list cause people don't pay attention otherwise. Tab characters kick ass because:
- One ident is one tab. Always. It's harder to fuck up.
- Collaborators can use whatever tab width they prefer - Get a good editor, meatheads!
- What the hell is the tab character going to be used for otherwise?
- You don't have to mash your backspace key multiple times to delete an ident
- Smaller file sizes.
If your project is cool enough ( or you're paying me ) , I couldn't care less if you ident with spaces. In this sense, I'm not much of a tab zealot. Just as long as everyone understands that "\t" is better.
Yeah, its a stupid topic to get worked up about. But as is everything.
