Blog Moved

My blog has moved!

Sunday, August 24, 2014

Setting the Standard and Practice Makes Perfect

Hello all, and I'm back again with another update, and honestly, this is a pretty timely topic for me.  We've all heard the term Coding Standards, and at many firms I've deal with they tend to be just some document sitting in a directory on the intranet collecting virtual dust.  But I want to discuss this particular idea and how this is a commonly underutilized tool for many senior developers, and something that is not being given enough weight by junior developers.

By definition, Coding Standards and Practices are a set of rules, and guidelines for developing code.  They are a formal document defining what programmers are allowed to do, and what they aren't allowed to do when writing their applications.  These standards should be enforced using tools like formal code reviews.  Honestly, when you say it out loud, this sounds absolutely essential, but in practice I find that these kinds of documents tend to fall by the wayside.  The benefits of coding standards should be fairly obvious, and I'm not going to list them here.  What I'm going to discuss is how to keep them current and make them work for you as a Senior Developer.

Step #1.)  Make sure they stay current.
The biggest reason I've found historically that these kinds of documents aren't used is because the last time they were updated was roughly 5 years ago, which in this industry might as well be a lifetime.  So what can you do?  If you're like most developers, you hear keep these documents current and think...oh god no, not paperwork.  Programmers have an aversion to paperwork like vampires do to sunlight.  The secret to this is pretty simple.  Keep the document light.  First and foremost, no one wants to keep a 50+ page document updated, and worse yet no junior developer wants to read it.  So do both sides a favor, and keep them simple and short.  Keep everything to the point!  Focus on the absolute most important standards only.

Step #2.) Ditch the master document.
Another way to help with #1, and keep your jr developers attention is to not keep one master document.  This is a huge waste of effort, it makes for having that long document, and your trying to create a one size fits all standard, which is never going to work.  Instead I propose that you create documents either by domain (web, mobile, service, database), or by technology (MVC, JS, Knockout.js, Angular.js, etc).  This will make the updating process easier, and it allows Developers to pick which standards to use on their projects, and they are not overloaded.  Also given that your standards are more targeted, the more likely they will be followed, and the better the quality of the standards.

Step #3.) Regularly meet with other senior developers to discuss the standards. 
Set up a regular meeting with other senior developers to discuss and deliberate about the standards, identifying standards that need updated, and standards that need to be retired.  This will allow for a constant updating of this document and minimize the amount of time spent by everyone on updating.  At the end of the meeting, each separate senior developer should have to update some of the standards documents.

Step #4.)  Bring a copy of relevant standards to code reviews.
If you bring them, then you will be more likely to use them.  The fact that the document is in front of you, will make you think about it more, and enforce it more.  The more you enforce it, the better the habits of your junior developers will become.

There will likely be more on this topic soon, but I wanted to post these thoughts right away.  Please feel free to discuss as I would love to start a dialog about this.