Tuesday, November 02, 2004

The War of Coding Standards!

Its a great shame how a group of individuals can collectively take a wrong decision, simply because of a influencial individual thinks its right.

Today at work, the Coding Standards Review Group decided to advice braces ( '{' ) placement in the next line, in Java code. The reasons that lead to this is as follows:

1) Its easier to follow.
2) Its more logical, Its easy for a programmer to compare an opening braces to a closing one, and treat what ever is between them as a block of code.
3) Existing codebase is largely formatted this way.


Why I think its a wrong decision:

1) Neither of these coding styles are particularly different. Its about what a person is used to, and how flexible he or she is to adapt to changes.
2) The idea of a brace ends another brace is err, not that great! The way to look at it is to see a statement (if, for etc) starts (ignore the '{') and then it closes with the '}'
3) Coding Standards are to ensure that the code is maintainable. And many of us wouldn't be here couple of years down the line, and the new comes with years of Java experience (or Only Java experience, No C or C++) would be naturally more comfortable with the Java Coding Standards, which places braces in the same line.
4) The industry standard. We are coding in Java, not C or C++. Sticking to the industry standards are always beneficial at one stage or other, and the industry follows the Java Coding Standard (with braces in the same line).

End of the day, the decision was made by a handful of Senior Developers, who have spend years coding C or C++ than Java. I have coded C++ years myself, but I moved on to Java, pure Java in 1998, and have long adopted the Java Coding Standard. And every new employee here at the workplace is more comfortable with Java Coding style, and still the decision is totally eclipsed by Senior Engineers just because they were used to that!

A less-than perfect world!!

No comments: