Oh yes, here comes another thing people can argue about. If you, by any chance, are missing a point, let me tell you this: there is an ongoing debate on what ASCII character should be used, to make indents in the source code. Some people say it’s TAB which is the only right way to make your code more readable. On the other hand, and no surprise here, there are ones who say otherwise, and try to convince the “other side” to change their mind. Who is right, which approach is a superior one, the best?
Arguments
Before trying to come up with an answer, let’s take a break and think about arguments. Do you consider them as something useful, or rather you see them as a destructive waste of people’s time? It probably depends, right? We can argue about something, but if it comes with mutual respect and open mind, it can be a great lesson for both interlocutors. If such situation ever happens to you, consider yourself lucky. You will be smarter, who knows how much more. And there are, of course, the bad ones, where instead of exchanging opinions you are involved in the real fight. Fighting man is to busy fighting, so he probably won’t see the value he gets. A choice.
Freedom
The more choices you have, the more free you are. Deciding on what indent character to use in your project, you are given more than one option. How? Let’s begin with characteristic of each of the signs.
TAB
TAB sign moves the cursor by a given number of characters. Open your terminal please, and hit TAB on your keyboard. See what happens? Cursor have moved a few widths of a single character. You can go back using backspace on your keyboard, observe that cursor jumps the same way it moved when you hit TAB. Whatever it is, terminal, text editor, IDE or any other editable resource, a TAB sign will be interpreted as an instruction, which tells how many positions should be indicator moved. The part when you get some freedom, is when you realize you can define a TAB value, meaning how many places it will move. Some people like it one, other like it two, some other four or even eight, and TAB gives them a choice. Since source code contain tabs, everyone sees the code just the way they like. And last but not least, this is the most semantic way possible to represent an indent.
SPACE
The great TAB’s opponent, a space. This character is a printable one, it has a fixed width which equals to width of the single character within a text. There is no option to change its width, so it will look the same in every team member’s editor. The problem comes, when coding standard of a particular project requires significant number of spaces, let’s say four. Can you imagine how many times developers must hit the space key on their daily basis? Definitely a lot. But there are still projects, where spaces are chosen over tabs - how they manage? Most of the modern IDEs has an option to extend tabs to spaces, when TAB is hit, it moves the cursor with four space characters. Smart, isn’t it?
Who’s the Winner Then?
The one who wins team’s hearts. The important part is, that using one character or another should be consistent across the whole project. Moreover, a consistency is one of the main pillars of a high quality code, because it makes it browsable efficiently, not only gives an easiness of reading. As for me, arguing over personal taste is a total waste of one’s time and energy, and this energy can be used for learning something new, reading an article on this blog or grabbing a beer with your friend. Your time is too precious to fight over a little things.
Make Your Own Opinion
My advice? Try both approaches. It’s the only way, to figure out what solution is better for you. Programming is such a special subject, because it allows you to validate your ideas quickly. You write a program, and you instantly check if it works as expected. If not, you can even delete it completely and start all over again. No materials wasted. You can do the same with tabs and spaces, just check which is better for you and use it consistently.