Software Developers - You Should Use Spaces For Code Indentation

in #programming8 years ago

There is a bit of a holy war going on between developers whether one should use tabs or spaces for proper code indentation.


In the end, it doesn't matter, of course. Your program should work regardless.

But, as did David Robinson from StackOverflow find out in the article Developers Who Use Spaces Make More Money Than Those Who Use Tabs there is a statistically significant difference in salaries related to use of spaces or tabs:



To quote David:

Indeed, the median developer who uses spaces had a salary of $59,140, while the median tabs developer had a salary of $43,750.

You can draw your own conclusion from this finding and decide if it is relevant to your situation. Or simply start using spaces if you are a developer and are currently using tabs. It can't hurt you.

If you do get a salary increase after the change you can tip me in Steem :)


Cover image source

Sort:  

And thy comments in the program should be written in English. wahaha....

:) It depends whether you code for an international company. I guess :)

We were discussing this at work. I don't mind which as long as people are consistent within a project. Editors can make spaces act like tabs anyway

And vice versa. Our internal coding standards declare 4 spaces.

Ps: I am in charge for these standards ;)

Yes, in some languages spaces have semantical meaning. Which is strange in my opinion.

Readability is broken when you have tabs and an editor which uses to many spaces to display these tabs.

Some languages, like Python, care about indentation, but otherwise it's about readability and I care about that

While I'm not doing software I am programming games in C# and looking at this argument it just seems to be a matter of visual taste to me. I know for instance when indenting I particularly disliked Unity monodevelop's automatic indentation to the point that I found out how to turn it off.

I completely understand you :)

Some editors can display tabs with too many virtual spaces and then the code becomes unreadable. It is way too much to the right.

That's why I prefer spaces. A space is a space no matter which editor are you using.

Got to tell this to my coding friends. I ve also done some coding but for some ppl coding can be quite hard thing to learn xD Great post!

Thank you.

Have a great Sunday.

I've stuck with spaces since a handful of the CMS's my clients use for their blogs don't handle tabs.

Would you prefer tabs instead? Why?

I'd prefer tabs to save the keystrokes.

:) You can have both - press the tab and four spaces are inserted automagically.

All depends on the editor. As I mentioned earlier, some of the CMSs that my clients blog on don't recognize tabs.

automagically --> is the single greatest term that I've read in ages. Thank you, sir.

You are welcome :)

And yes, the choice of the proper editor is very important. And the setup of the editor, of course.

Hi @ervin-lemark,

Im forming my own school, "The Shunners Of Indent"!

We believe that code should nestle against the left, and that indentation is a waste of space! Join the revolution!

Hello. Interesting. Can you point me to some examples or coding standards? TNX!