Posts Tagged ‘standards’

Coding Standards – Are They Worth It?

Monday, March 16th, 2009

We have a very agile and elastic team, so if we have a large project, we manage outside contractors if we already have a heavy production schedule.

The problem with this is that the quality of code, and style of code differs hugely from person to person. This is more and less of a problem in some languages, PHP affords much more style flexibility over a language like Python.

How do you make sure that everyone is coding and thinking the same way?

Documented coding standards are the best way to achieve a consistent coding style. Now it does require some up front learning, and the use of peer reviews but that is a small price to pay for consistent code.

What should coding standards contain?

They should contain all the rules, and standards for writing code in your organisation:

  • Should curly braces go on a new line?
  • How many spaces do you indent by?
  • What is the convention for class names? Camel case, lower case?

I wrote the coding standards with my team, and it spans six pages, which sounds like a lot, but once you start coding after a day or so, you never really need to refer back to them.

I love coding standards and they have helped us a lot in writing clean, consistent code and managing and integrating contractors into the team.