Archive for November, 2009

Coding standards

Thursday, November 26th, 2009

First off let me apologise if this turns into a little bit of a rant from me but this is a pet topic of mine so I could be liable to  go off on one. I’ve also just been working on a project that has had me running into the corner of the room screaming because of the standard of the code (luckily my colleagues are used to my slight idiosyncrasies).

Coding standards are not a new thing by any means, and in my view are really essential to any organisation. They help to promote consistency and ensure that anyone working on a project knows how they should layout and structure their code. This way it becomes much easier to read (especially at first glance), new developers have a handy reference detailing what they should be doing and everyone is generally on the same page with how things should be done.

PHP_codesniffer

Pear LogoTo make life even easier there are applications around like PHP_CodeSniffer that can automatically check that your code confirms to the set coding standards so you don’t have to worry about remembering every single point in the standards. I’m not going to write much about this in detail as there are already some very good references out there such as this one on techportal by lornajane. The documentation on the PEAR site is also very good and shows you how to create your own sniffs, and there are also plugins out that link into some of the most widely used IDE’s, such as this one for eclipse.
(more…)

Share