RSS Feed

A look into coding standards

Standardisation in any programming language is usually put in place for a reason. Simplicity and understanding of a set of standards and abiding by them tackles one issue with moving from project to project. Sticking to the same coding standards as everyone else in your team or the known underlying standards adopted from the language developers is important and saves everyone time.

Having a consistent environment from project to project means programmers can move to any piece of code and figure out what’s going on without having to learn new, non-standard methods of laying out code. It’s also something a group of programmers would have in common. We deal with enough code problems as it is, why add additional enemies to our list?

One issue I often run into when discussing standards is people thinking a standard is petty – but if it’s petty why would it be put in place?


Let’s take indentation as an example; Here at Bluhalo we have a specific standard of using 2 spaces for indenting which has been adopted from symfony, being our framework of choice. Everyone at the company abiding by these standards means less configuration to your editor when moving from site to site – not to mention the code layout will always be displayed as expected.

Another standard we tend to abide by are the placing of brackets. While the following two examples are pretty much identical to each other the difference in placing helps a great deal with readability:

Our way

if($something == true)
  // Do something
  // Do something else

Another conventional way

if($something == true) {
  // Do something
} else {
  // Do something else

I personally feel the first example is a great deal more readable than that of the second method shown above.


My thoughts on standardisation will not change the way people code but hopefully it will help people realise the importance of standards, whether it be globally or company bound.

Syntax standards can help a team of programmers a great deal, why not form your own standards, whether adopted by Zend, symfony or some other standard.

Posted in Development on the 29th April 2010

2 people have spoken their minds!

  1. JaTaMan says:

    I even will go farther.
    Plese see

    if (expr)

    I’m tailking about space after IF.


Your email address will not be published. Required fields are marked *