Freelance Full Stack Developer
Hello, children all over the world. In today’s class, we’re going to talk about the importance of keeping your code/ script well organized and tidy. Please take it with a grain of salt, I don't believe there is right or wrong in development.
In particular, I’d like to talk about a Japanese technique called 5S. In short, it consists of five “ways” that help to create an organized work environment that pursues effectiveness and efficiency. Those are:
Seiri, Seiton, Seisō, Seiketsu & Shitsuke.
Ok, so far so good “but does it have to do with software development” you might ask me, and I’m glad if you did. In my personal opinion, it seems that this tool might be very useful if applied in software development.
Seiri means sorting through all items in a location and removing all unnecessary items.
Not to mention all of those W3schools, MDN and Stackoverflow tabs opened about one and half hour ago, that are still open even though not being used, let's focus on actual development.
In front-end development, one thing that leaves a mark on is the planning ahead. In the image below we can see there are some unnecessary lines of code there, which could have been avoided if the display properties of the
tags would have been understood.
Seiton means putting all necessary items in the optimal place for fulfilling their function.
In this matter, I can’t help but think about grouping information that is related together. In really big projects this can make a huge difference, in terms of maintaining the code.
Let’s think about CSS for instance, in the image below, we can see in the left example that the information is not grouped, in the example to the right it's grouped and commented.
In the back-end, a persistent example is class declaration, when doing so it's important to try and keep pertinent information grouped together. As we can see in the example beneath.
Seiso is to clean and inspect the workplace, tools, and machinery on a regular basis.
By my personal experience, rushing through a project is probably leading to a whole bunch of bugs, and that later on can be quite troublesome to be fixed. While developing an application, inspecting the script with tools such as linters and code validators can be very helpful to assure a certain level of reliability on the expected output.
Another approach to this would be the so-called Test-driven Development. As described:
Relies on the repetition of a very short development cycle, in which requirements are turned into very specific, test cases then the code is improved so that the tests pass.
Seiketsu is to standardize the processes used to sort, order, and clean the workplace.
I reckon this is probably one of the most relevant topics in software development, especially when working remotely. The importance of creating standards can be identified in many different aspects. Probably you have already heard of World Wide Web Consortium and Camel Case.
Let’s bring this subject to a development example. In the image below it's quite tricky to understand the parent/ child relation between those elements, that could be easily avoided using appropriate indentation.
Shitsuke is to sustain the developed processes by self-discipline.
This one is the hardest to exemplify, it means to create and develop the habitude, in everyone who's involved in the project, to practice what's being told in the previous steps. In remote working maybe it's the toughest to achieve since we're dealing with people of many different cultures and backgrounds.
Of course, these principles can be used in many other examples, not only in professional sphere but also in personal and academic. As I've said before, I believe there's no right or wrong in software development. What we can rely on are good practices and, in my opinion, using 5S can be very helpful in accomplishing those.