Jake Intel

Tyler Bruffy

Four Key Principles of Clean Code

What is Clean Code?

We pour over many websites here at the Jake Group – some built by our own development team and others designed by outside programmers. In both cases, we always look for high quality code that is easily interpreted by people rather than merely by computers. When code is written in a way that is simple to read and painless to maintain, it’s considered “clean”.

That said, clean code is subjective, and every developer has his or her unique perspective on the best approach to keeping code as straightforward as possible. While there are certainly prevailing ideas that are considered best practice within the web development community, there is no definitive handbook. For that reason, we have established several core principles that guide our workflow so that all Jake Group developers can work together seamlessly on the same projects. Our top rules to work by include:

1. Follow a Naming Convention.

Each element of a website requires a name, so we make sure to create precise and meaningful naming conventions. When sharing code with other developers or coming back to a project after some time, an effective naming strategy is key. The importance of naming impacts every aspect of our development. It’s present in our CSS and HTML, in the variables in our back-end code, and even in how we present the ability to edit data in the CMS.

2. Be Concise.

Run-on sentences can be hard to follow; likewise, it’s cumbersome to pick through never-ending lines of code. That’s why we stay concise by following the single responsibility principle, a term introduced by Robert C. Martin, author of Clean Code. The rule states that a class or function should have one, and only one, reason to change. By following this principle, we can reuse code in multiple places, keeping our code as organized as possible and helping maintain stability as the site evolves over time.

3. Stay DRY.

DRY stands for “Don’t Repeat Yourself”, one of the most important acronyms in coding methodology. If we repeat ourselves, we introduce complexity to our code making it more difficult to maintain. For instance, if one section of code requires a change and the same code is repeated in another file, we may fail to realize the need for an additional update. When we follow the single responsibility principle, there is no need to repeat code, because our programming is focused and created in a way that encourages reuse, not repetition.

4. Refactor the Code.

Code refactoring is the process of improving the internal structure of code without impacting its external behavior – simply put, it means streamlining the code to improve its readability. Just as we might edit our blog posts several times before they’re published, we make sure our first pass at code is never our last so that any added complexity is eliminated.

While this is hardly a comprehensive list of clean code do’s and don’ts, these four strategies are our most important guidelines for any large-scale development project. By following this clean code etiquette, our team can be sure the back-end code of each of our websites is as clean and beautiful as the front-end display visible to the world.

For more information about our website design and development capabilities, please contact us today!