I asked a question yesterday on Twitter about how people who work in large teams of developer (my example in this case was 10+) keep their code formatting/approach in check across that number of people.
Thanks to a retweet from the wonderful Rachel Shillcock (rachil.li), I got a whole bunch of replies, many of them suggesting that I should implement the use of a large stick and a certain amount of violence to make sure everyone keeps their code in order.
So I took a quick look and my attention was immediately grabbed with one of the bullet points:
Code MUST use 4 spaces for indenting, not tabs
This put me right off!
I've always used tabs to indent my code, from the days when I was at school programming in RM Basic (yes, I am rather aged).
I personally have always found the use of spaces to be very restrictive. When I work with other developers on a project, some prefer the look of a 2 space indent, whereas sane people, like my good self, prefer 4 spaces.
The use of the tab allowed each developer to individually set their preference in their IDE to whatever display of the character they wanted.
As long as the indentation was created using tabs, the indentation itself would be standardised, but the developer would be able to control how the tab character is displayed to them.
I've always favoured spaces. Spaces are uniform, tabs aren't. Code *should* be indented by four spaces
My counter-point was:
Surely tabs are more flexible than spaces in that case?
And then he said:
But standards are supposed to standardise things; everyone should be singing from the same hymn sheet
This was the statement that cleared it up for me.
Everyone has their own preferences, but individuals have to make sacrifices in the way they prefer to write code for the greater good.
This is particularly poignant for me as I'm in the middle of writing up some coding guidelines for the dev team at @thinkbda.
The changes I'm planning are going to annoy some of the guys in my team, and I'm going to be one of those annoyed individuals. I will sacrifice some of my preferred methods when writing code to help standardise everything that comes out of our development studio.
So what sacrifices have you made to adhere to standards in a team of developers?
Have you had to adjust or create your own guidelines like I'm doing now?
Let me know in the comments below.