3 best practices: Refactoring, Code Review, Pair Programming
Keeping your technical debt at an acceptable level is essential to maintaining your project under control. Refactoring, Code Reviews and Pair Programming are 3 useful practices.
When you refactor a part of your application, you redesign it in order to make the code more efficient and clearer. Although refactoring provides no improvement in business features, and could even provoke regressions, it is a good idea to do some from time to time. It is less risky and less time-consuming if you have good automated test coverage; if you have tools and indicators to monitor this, it will make refactoring seem much less daunting a task.
A code review consists in having two developers read, discuss and occasionally correct each other’s code. It goes without saying that while doing code review, the developers aren’t producing new features or writing new code. Having said this, you should quickly see an improvement in your quality KPIs followed by a shift towards higher code quality and better design techniques.
Popularized by XP methodology, pair programming consists in having one developer code while the other one reviews and makes comments. It does have its detractors, however, as it seems at first glance that a given feature will end up taking twice as long to produce. The reality, though, is more nuanced; the duo will produce higher quality code and will learn from each other. Try it in your team from time to time, and see what impact it has on code quality.
For a project manager, these 3 practices can all prove useful in their own right. But it’s not because you’re implementing regular code reviews in your team that you should forget about refactoring or not try some pair programming. The challenge is more about balancing the three, to keep your technical debt as low as possible.
To help managers in the decision making process, there are tools with code analyzers and defect-hunting modules that provide reports and indicators such as % of duplicated code, the respect of coding standards, the absence of comments etc.. These tools are designed to support global continuous improvement in code quality and can therefore be used to define the quality management strategy.