March 4, 2018 · coding standards

Consistency

Consistency is important in software development. I would argue it is one of the most important traits a developer should have. Moreover, when working with a team, the team's consistency becomes an even more important and vital aspect of the development process.

We all know, or should know, about the various coding standards. For PHP there is PSR-2, and there are similar coding standards for other languages. However, is that all it takes to have consistent code, a coding standard? If all the developers on a team use PSR-2 will their code be consistent? Absolutely Not. 100% guaranteed a team of developers cannot write consistent code by merely adhering to a coding standard. This is an interesting fact I’ve learned over the years.

We have to look beyond the code and at the architecture, the entire project and code base as a single living entity. It’s much like designing a town. Agreeing on paint colors, lot sizes, street sign placements and roofing materials is not enough to build a town. There needs to be thorough planning and consistent use of paradigms.

Continuing with the town analogy, if forethought about the zoning, street intersection, and street layouts are set in place as the structural standard, then the town can be built to handle growth.

Let’s say the town grows by 2x every year. That is going to mean expansions to the town layout and surroundings. Since street intersection and layout patterns have already been decided, it is trivial to make the necessary changes to accommodate the growth. On the other hand, if the initial phase of planning wasn’t done with an overall view of the city, and all the builders built roads, intersection, and buildings expanding the city would be difficult because there are so man different implementation to achieve the same goal.

Likewise, we should approach software development in this way. There are many design patterns that will achieve the same end result. But, the development team should decide on which design patterns they are going to use and when to use them. Otherwise, you will find yourself in a situation where there are different pattern implemented to solve the same problem. This will lead you down a path to a full system rewrite - something that is never welcome.

Consistency in system design is a crucial aspect of the maintainability and longevity of any software system.

<?php

namespace Developers;

use Skills\Consistency;

class ExperiencedDeveloper
{
	uses Consistency;
}

Comments powered by Disqus