DEV Community

bosiarquitetura
bosiarquitetura

Posted on

5S and Code Quality

5S is a well known quality system developed is Japan after the Second World War to guarantee that the company using it was delivering the best quality products the could, while creating a good work environment. One of the most famous company using it is Toyota. Its focus is on manufacture companies. However, this quality system also appear on code quality books, like the "Clean Code" and can help tech companies achieve a better code delivery by creating a work system around 5S' principles.

The 5 principles

1. Seiri or Sort

Seiri is sorting all items and removing anything unnecessary by tossing it away. The ideia is to create an environment where is easy to find anything needed, avoiding distraction by unused item and/or trash.

Based on this system, we should remove any unused code from our base. That mean, any code that is commented out (You ain't gonna need it), any comments that doesn't explain anything, and, of course, any code that doesn't do anything or that isn't even called on the rest of the base.

2. Seiton (Set in Order)

This principle aims to organise anything that was defined that is necessary but is out of place or is hard to understand its use. This creates a smoother work flow, where everyone knows what anything is based on a categorised system.

Thinking on a code environment, our folder system should use names that are easy to understand and every piece of code has to be on a folder that is related to the category that code should. That also means that we must avoid create folders that has lose meaning, like "utils" and "helpers", because putting code inside these types of folders is like putting it on a bland deposit, who knows what could be inside of it?

3. Seiso (Shine/Polish)

Seiso is cleaning and maintaining the workplace, equipments and machinery. This helps avoid accidents, by keeping everything is place and working as it should. Also, anyone that keeps cleaning their tools, are also more able to see when anything isn't working as it was supposed to be.

As we keep working, our code will get messier. We'll do some minor changes that shouldn't be made or make some poor choices to solve some bugs that we need to solve that exact moment. If we don't come back and clean all these problems, our code can get hard to read, or lose performance. The natural state of any code is to get "dirtier" as we keep working on it. So, the process of cleaning it is just a natural response that we need to do to keep it clean.

4. Seiketsu (Standardize)

Standardize any process, including the process to maintain the three principles above. On here we can also add standards for tests, for what programming paradigm your company will be using. Add/create any standard that can help programmers code faster and maintain the code base.

5. Shitsuke (Self-discipline/Sustain)

The last principle, but not less important, is related to self-discipline or to how can we sustain all the other 4 principles. Some people also translate this principle as "doing without being told".

The first part of it is having the discipline to maintain the other four principles. However, this principle also incorporate the study and training that is necessary to be able to always be better. Another important part of this is receive and giving feedback, specially from those that is on the frontline of the work, on our case, the developers and designers.

Top comments (0)