|Problems? Is your data what you think it is?|
Why Create Coding Standards and Perform Code Reviews?by eyepopslikeamosquito (Chancellor)
|on Jul 02, 2009 at 01:27 UTC||Need Help??|
Since writing On Coding Standards and Code Reviews, several people have asked me:
I should have thought about this earlier because it would have helped focus our coding standard effort on tangible business benefits.
To remedy that oversight, I list below what I see as sound reasons for having a coding standard and for performing code reviews. I'm posting my notes here to gain some useful early feedback.
Why Have a Coding Standard?
Successful software tends to live a long time: bugs are fixed; new features are added; new platforms supported; and the software adapted to new markets. That is, successful software development is a long term activity. If you plan to be successful, you should therefore plan for your code base to be maintained by a succession of many different programmers over a period of many years. Not planning for that is planning to fail.
This is the primary reason why you want a company coding standard: to make long term code maintenance easier.
Notice that if you choose instead not to mandate a coding standard, you'll likely end up with an informal one anyway, as some strong personality in your organisation fills the vacuum by evangelizing their own set of pet coding rules.
The goals of a good coding standard are:
The above list represents real business benefits which should help you decide what to put in your coding standard and what to leave out. My experience here is that shorter is definitely better. The longer your coding standard document, the less likely that it will be read, understood and followed.
Why Perform Code Reviews?
Of course, code reviews are not free and there is an opportunity cost in that time spent reviewing code means less time spent on other activities.