Code Quality I: Good Practices
Clean code and other healthy programming habits
We have previously discussed some definitions and general aspects of quality. We will now take a more practical turn and see what can actually be done to satisfy our quality needs in a software project.
Agile methodologies are nothing new nowadays. They have proved to be invaluable in many companies and there are a lot of them.
One of the most widely used (though in very different flavors) is Scrum. The idea here is not to write yet another post about it, rather just to mention it as one of the tools we consider essential because it allows and encourages communication and visibility throughout the team, and provides a mechanism to comment and correct workflow issues early in the project.
At the very least, ALWAYS do the planning, daily and retrospective meetings, or you might find your project spinning out of control.
Structured Repository Setup
In order to favor good practices such as feature branching (when working with a version control tool like Git) there are some configurations we should pay attention to.
It is beyond the scope of this post to explore the benefits of clean coding, but we just have to mention it since it is paramount to having a healthy codebase. Robert C. Martin keenly explores and exemplifies it in his book “Clean Code”. It is also worth recommending other books in the series of Robert C. Martin: “The Clean Coder”, “Clean Architecture” and “The Software Craftsman”.
When developing a new feature, use short-lived branches. This favors code reviews, and helps keep project history clean.
Be it in a commit message, an issue report or even when talking to a colleague, provide context of what you’re saying. No one likes issues like “move folder” or commit messages like “fixed things”. Don’t do that. Ever. The world will be a better place, and people will love you more.
Referring specifically to commit messages, say what was done in a very short phrase and reference the issue that requested the changes you are submitting. You will lose one minute, but will save hours of someone else trying to understand what you did and why.
Kindness And Attention
Some say that quality is the result of countless acts of kindness and attention. It is within ourselves to continuously take action and turn our everyday activities into the building blocks of an upward-spiralling workflow. In doing so, we might feel it takes longer in the short term, but it saves lots of time and headaches in the long run.