What and why: Coding standards

During my day job with Human Made we build sites at scale for enterprise clients – with WordPress as the CMS. Our team and clients are based all over the world, being completely remote.

Our engineers find themselves on multiple projects each year and coding standards have a huge part to play in making transitions, onboarding and daily working a much happier experience.

WordPress Coding Standards

WordPress already has a set of coding standards which aren’t enforced within the WordPress codebase itself currently – but is generally accepted across the community.

With WordPress built on a GPL v2 license anyone can edit, create and re-distribute the source code as their own. Combine this with 30%+ of websites being built with it, there are hundreds of thousands of developers worldwide writing code to use with WordPress.

Imagine if these contributors didn’t use a coding standard? Reviewing plugins, WordPress core and related projects would be a nightmare to contribute to.

Create your own coding standards that enforce your project or team best practices

While a large project like WordPress features their own standards, teams, companies and other projects should create their own coding standards which codify their internal best practice.

At Human made we have our own set of coding standards which automate much of engineering handbook best practices.

Both projects are living – in that they evolve with the web technologies and changing best practices used.

What comes next after establishing a company or project wide coding standard?

You can take this much further than just having a coding standard.

  1. Automate it: Iulian Popa wrote a wonderful article on Automate code standards validation with Composer, Git Hooks and PHPCodeSniffer
  2. Continuous integration: Your code standards can be run against every commit and violations reported when code is pushed to Git or your chosen VCS. Ensuring all code conforms at all points in time.
  3. Iterate: Best practices evolve, don’t lock your team into a single point in time – change with them.

Really for me, coding standards are a small, yet effective promise between developers on a project team.

If you don’t use coding standards and even if you are by working solo – you should. Be kind to the future you and start today.