Clean Code: universal code aesthetic

whenever I see the title regarding the code and it's quality I wander whether it is possible to define one universal way of writing code that will be accepted by all the programmers within the project. We are, usually, people who graduate from various schools, we have different "code taste" and different programming style (like in high school - there is no chance that everybody writes the same essay even thou everybody writes about the same thing).

Now, to the question.

Have you, during your carer as a consultant, managed to convince large group of people to adapt a new coding style? If you have managed to do so, how did you make the people to keep this style over the project in time?

whenever I see the title regarding the code and it's quality I wander whether it is possible to define one universal way of writing code that will be accepted by all the programmers within the project. We are, usually, people who graduate from various schools, we have different "code taste" and different programming style (like in high school - there is no chance that everybody writes the same essay even thou everybody writes about the same thing).

Now, to the question.

Have you, during your carer as a consultant, managed to convince large group of people to adapt a new coding style? If you have managed to do so, how did you make the people to keep this style over the project in time?

Thanks for the answer

Hello Kelahcim:

I make the point in the book that coding styles and disciplines are rather like martial arts. One person may learn Karate, another may learn Jiu Jitsu. These arts are very different but both are valid. More to the point, a Karate expert can learn a great deal from studying Jiu Jitsu disciplines and vice versa. The style I promote in the book is not "THE ONE TRUE STYLE"; it's just what's worked for me and my associates for many years. You may not agree with all of it, but studying it should be beneficial.

Now, on to your question. Code style should belong to the _team_, not to the individual. When I work on a team I get everyone to look each other in the eye and admit that it does not matter one whit where the braces are placed, so long as everybody place the braces in the same place. The variable naming conventions, the class naming conventions, the indentation style, the error processing style, etc. should all be agreed by the team and practiced without exception. The team standard should be a document of conventions that _don't matter_ for any reason other than that they are the agreed style.

How do I get the team to do this? I appeal to their professionalism. Professionals work together. Professionals realize that individual style must be subservient to team style. To insist on your own style while on a team, is unprofessional behavior. It would be like a team of surgeons doing a complex heart transplant, all using different tools, techniques, and procedures.