Coding standards

Coding standards determine how you should code. They contains such things as guidelines for the location of braces, naming conventions and coding constructs that are a must use and a no-go.

There is a paradox here: if you are need of a coding standard, it signals that people have varying preferences when it comes to coding. And if that is the situation it is almost impossible to arrive at a standards everybody conforms to.  Instead introducing a coding standard in those circumstances is more likely to polarize the two “OneTrueBraceStyle” camps.

I have switched over my career between the two “OneTrueBraceStyle” camps more than once. The reason: the environment contained code in another style and it was easier to switch my style than vice versa.

My experience is that only time can make developers use the same conventions. So if more uniformity in code is needed, a coding standard is making you move away from that goal. Instead invest in enhancing collaboration and dialogue within the development team.

Coding standards do serve two valid purposes. One is informing newcomers on your team how you work (and not how you want to work). The second purpose is education. Good coding standards are not only about style. They are also about constructs in the language that are syntax wise perfectly legal but can lead to unexpected problems.  Read a good coding standard and you end up wiser.

Advertisements

%d bloggers like this: