Clean Code and Software Crafters — Luis Castillo Benavides
There is a really popular image going around through the social media about a programmer that doesn’t know how the code he created is working. More shocking is that he doesn’t know how to clean and optimize his own creation. This is a very often problem that programmers face during the firsts years of experience of production.
There is a lot of pressure of making your project to work and put it on release, that sometimes, the quality remains in the background. Because at the end, our clients will not actually reed the code, right? They just want the app ready in the deadline we gave them, and making the things he wished the app will make. And hopefully, the software does… but, what happens when it doesn’t?
We face the pressure of an angry client, with the deadline against us, and with a lot of bugs that we couldn’t get rid off since the beginning. But it is now too late. We were struggling to make the release of the code as fast as we could, and we forgot about all the good practice a programmer should do.
That is why clean code matters. Now, not even you can fix the issues from your code because you don’t understand what is actually happening with your variables and with your functions. You start to forget why your wrote those lines of code, and why some others are commented, and you begin fighting not with the issues, but with your own code.
Software Craftsman
Software craftsman are one of the most valuable assets in a software company. They are really productive with the code and can work really well in teams with their pairs. But why is that? Why they usually make better and understandable code? In what they focus on to do such thing?
The difference between them and a normal software developer is in the bold words. Of course they focus on working software, responding to change, reviewing individuals and interactions and thinking of the customer. But…
Key values of Software craftsmen
While they are working software, they spend some of the time, thinking and developing well-crafted software. It is not just about getting things done, and expecting never seeing the project again. Is about making each line worthy to read and in harmony with the rest of the project.
Of course in this industry, we’ll face change and we have to be prepared for face it. But a Software craftsmen see this as an opportunity to add value to the project and making a more robust solution.
One of the most important key of the success of working in the software industry is about teamwork. They don’t see the environment as a group of individuals, but as a community of professionals that can add value to the product by pair programming and asking for advice and solutions because, at the end our customers are more than that. They are productive partnership for further projects.
So, how can a Software Craftsman write good, clean code?
About Clean Code
Regular Expressions can be an outstanding ally or a chaotic enemy. There is much less words, and it goes around with a lot of non-alphabetic symbols. This can really clean code for you but it can also be not very clear for other programmers.
Let’s face it, when we started coding, we were all trying to make our code works at first, and then check if we can clean some code, erase some unused classes, rename variables or even optimize the algorithms with the fear of adding some new bugs. But, why is so important to write understandable code for others?
Let’s get back with the example. If you are with a team programming some project, you have to be clear with the instructions your code does. This is not only because of mutual respect and teamwork, but because the code is a reflection of the professional you are. Is like craft a new piece of art with your signature on it. And you should be proud of the code you are making, and others should feel comfortable working with your code.
That means that your expression should be as clear as if they were writing every single instruction explicitly, with a lot of comments, but actually without them. The condition, the names of the variables and the instruction has to be with a strong structure, and telling you actually what they are doing like a good prose. It is like seeing a tunnel and actually knowing where is the path without rare deviations.
Not always clean code, means less words, less lines. It is about a good structure of functions, variables, classes and projects that makes it easy to work with, and there are a lot of suggestions to make it cleaner. They are suggestions because without them, your code will probably works. But will the production time will remain the same as time goes by?
In the next blog, we’ll be taking about all the tools that can develop better code, making it cleaner. One of the most important tools is TDD (Test Driven Development) and it is a powerful manner of developing functional code without the constant headache of bugs.