2014 / 29 November

Why coding guidelines and conventions are important

dt130921This often struck me when I was on-boarding in a development team. It often happens that there are no coding conventions or guidelines in the development team. One of the first things I do then is talk the team manager into adopting some guidelines. Usually, the manager (which is a non-technical manager) needs some explanations on why it is important. So here is what I answer:

  • When reading code which is flavored (each developer chooses guidelines for himself, if any), it is made more difficult because you don’t know what to expect. Don’t forget that when looking into code written by another developer, you probably don’t always have the full context (functional, technical…), so guidelines can help you to navigate around the code.
  • The quality of the code which is produced will be better if the developers have strict guidelines on how to write the code.
  • Maintenance will be made easier. The developers fixing bugs don’t have to lose time understanding how the code has been written.
  • Each developer knows which technologies he can use. He won’t be using some other fancy stuff that nobody has heard of.
  • Upgrading to newer technologies is faster; Procedures to migrate from the old situation to the new one can be written and followed. There will be nearly no special cases. With no conventions nor guidelines, there would be nothing but special cases.

There is also 2 things which I have to point out. I believe that the coding conventions and guidelines have to contain at least 2 things:

  1. How to name variables, what kind of instructions to use (for instance should I use a foreach or a while…) etc. The STYLE of your coding
  2. Which TECHNOLOGIES to use, and HOW to use them, for instance should I use EntityFramework or another OR Mapper? Which version of EntityFramework should I use? Should I go for Database First or Code First?

Both of the above are important. The most important reason is CONSITENCY!

Ok, so before you ask one of the developers to write some guideline or convention, have a look online, there are already plenty of those online, and just adopting one might juste be enough for a starting point.

This is a blog post I wrote a few years back for the blog of my previous company. I have updated it and reworked it a bit to publish it here.

No comments so far.