Chat > Tech Chat

Spaces vs tabs for source code

<< < (2/4) > >>

WWWombat:
I worked in an environment where we gradually moved from "one person, one module, one editor" toward something closer to a free-for-all anarchy. Part of QA always had a peer-review component, so it was imperative that everyone could follow other people's coding style, even before they then needed to work on it.

Nothing caused bigger problems than the tab-vs-space argument, especially when compounded by some people's desire to use a 4-space tab in their editor. Where to put the closing "}" bracket was a distant second place.

In the end, we learnt that the best answer was to force through a single coding style (for the complete code) that specified spaces. Editors could be used with the tab key, but set to an auto-indent mode that added space characters not tab characters, and aligned at 4-character intervals. This really helped everyone, from the smartest down to the weakest junior team members.

Like @7LM, the circle turned as integrated development environments became more capable. The problem of displaying indentation is then left to a smart editor.

The battle in the middle, it turned out, was really between a team taking collective responsibility for quality vs individual ego. And, in places, it was quite a battle.

How does that relate to the difference in salary? I wonder...

For a software organisation, there is nothing more important than the quality of your software, and the QA process you choose to follow.

In this context, then, perhaps that difference of salary is explained by how much of a team player you are, and how much emphasis you and your team collectively places on QA. Those who can subsume their ego into a best practice that is understood by everyone might just go further in the organisation, and get paid more.

Chrysalis:
Yeah I read the article and found funny.

I have always used tabs but I only write shell scripts not programs.
I also use tabs in config files.

The exception is if I am editing a script I didnt create or a config where spaces were already used and dont match the indent size of tabs, then I will use spaces.

Tabs just save so much time.

sevenlayermuddle:

--- Quote from: Chrysalis on June 20, 2017, 11:56:12 PM ---The exception is if I am editing a script I didnt create or a config where spaces were already used and dont match the indent size of tabs, then I will use spaces.

--- End quote ---

Ah, but even if the indents are spaces that do match your own editor's tab stop, and so you use tabs, the next person to view or edit the file may have a different tab stop and will see wonky indents.

Regarding the alledged salary difference, I wonder if it might just be that those who favour spaces are more likely to have worked for multiple different employers, with multiple different ear bashings from new pedantic colleagues, until they finally gave in.   The point of switching jobs is often to get a pay rise, after all, so they might well skew the statistics. :)

Chrysalis:
its simple really, using spaces takes more time so as such they are worth more money.

I have had one guy who insisted on me using spaces, I did it but it cost him more money.

I accept the point on mismatched indent sizes, so any file shouldnt have mixed tabs and spaces.

WWWombat:
The concept of "saving money" seems to be restricted to the case where one person edits the code.

I found the biggest waste of my time (and hence the company's money) was when I had to sort out random indentation because there was a mix of tab and spaces from other people, who used different philosophies and different tab indents.

In the interim period, where you gained freedom of choice over the editor, I tended to use emacs set with auto-indent features on IIRC, and to use spaces rather than tabs: I hit the tab key once, it took me to the right place using spaces. A philosophy that seems to have moved over to IDE's.

There are uses for mixed tabs and spaces, though it might depend on your choice of language. There is a "Tabs are evil" page talking through philosophy.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version