The good news is that you don't have to massively change your programming habits or enter a whole new world. Clean Code is comparable to moving from apartment A to apartment B:
- Step 1 in moving: you first prepare everything: Moving boxes, looking for moving companies, etc.
- Step 1 in software development: You set up the development environment and, if necessary, put together the team.
- Step 2 in moving: You pack everything into moving boxes and label them.
- Step 2 in software development: you start programming and write comments.
- Step 3 in moving: A moving company transports everything from apartment A to B.
- Step 3 in software development: You and your team successfully implement a feature, a system.
After step 3, the move is theoretically complete. We have arrived at apartment B and have our stuff there. We could leave all the moving boxes on the floor and get everything we need from the moving boxes, use it, and put it back in the moving boxes. Similarly, after step 3 in software development, our feature or system is also finished. We have programmed something that works and does what it is supposed to do.
However, when moving, we humans take a fourth and crucial step:
- Step 4 in moving: we clean up. We take all the stuff out of the moving boxes and distribute it into closets, shelves, etc. But why do we actually do this? The answer is amazingly simple. We want to have order and make room for new furniture.
- Step 4 in software development: Missing - This is where more than 80% of developers stop! The 4th step in software development should be clean code. Here we should clean up our code. In the moving example, step 4 (clean up) provides more space for new furniture. Similarly, step 4 (Clean Code) in software development makes room for new features. Our code will be easy to extend, easy to test, and of very high quality.
In other words, develop steps 1 through step 3 as before. However, you should learn step 4 in a practical way and integrate it immediately if you and your team want to produce above-average code every day. The good news is that any team can learn and immediately integrate Clean Code into their day-to-day work.
Why is the fourth step (Clean Code) missing in software development for over 80% of software developers?
We can even answer this question from our experience at elite universities and from our numerous trainings. Most developers don't even know how to do it. They have not learned the best practices for writing clean code. This is because such techniques are not taught in a practical way at university or college, nor in any computer science training. If at all, it is done through a lot of theory with little reference to practice. A second reason is that many developers have to meet one deadline after another and often have no time left for cleaning up. This saves time in the short term, but in the medium and long term it proves to be a strategic mistake as soon as problems arise. This is because 80% of the costs in software development arise later, for example when software errors and bugs are fixed or when the time-consuming and tedious adaptation of code and design for new features takes place.