Preventing technical debt
In the previous sections of this guide, we’ve talked mostly about how to deal with technical debt after the fact. So what can you do to minimize accumulating bad or unnecessary technical debt in the first place? Here are strategies aimed at preventing technical debt altogether.
- Embrace agile development methodologies. It’s no secret that Skylight advocates for agile development methodologies. That’s because agile offers a framework of proven process and technical practices (for example, frequent iterations, retrospectives, continuous integration, refactoring, automated testing, collective code ownership, definition of done, work-in-progress limits) for creating high-quality software and avoiding technical debt from the start.
- Give thoughtful consideration to the architecture. Choose languages, databases, and frameworks with careful consideration of the project needs, and consider the strengths and weaknesses of those choices. Make each of those decisions from modern, open-source, and stable projects. Changing these bigger decisions is expensive and hard.
- Use good software design practices. The best laid architecture choices are often insufficient to handle the unknowable future. For example, it may be necessary to extract services from a monolith, or switch databases for stability and consistency. The goal of good software design is to reduce the cost of change, whether that change is the addition of a feature or big architectural changes. Cross-language concepts like loose coupling, cohesion, and YAGNI (“You Aren’t Gonna Need It”) help any project reduce debt. In addition, each programming paradigm has best practices with SOLID design principles being applicable to both functional and object oriented languages.
- Understand user needs and conduct solution experiments. Don’t get married to a technical solution or approach too quickly, particularly one that’s complex and hard to reverse. Unfortunately, automated tools can’t detect bad architecture decisions or technology choices. Take the time to understand user needs and to explore a range of solutions through experimentation or prototyping to arrive at an answer (referred to as a spike solution in agile).
- Be prudent about incurring technical debt. Sometimes it’s prudent to accept technical debt for short-term tactical reasons, but be sure it doesn’t cause irreversible damage and that you’re prepared to pay it down in the future.
- Continuously inspect code quality. There are a number of tools for automatically analyzing the quality of your code and alerting you of potential hotspots (for example, coding standards violations or code duplications). Include these tools as part of your continuous integration strategy. Additionally, adopt pair-working practices such as peer code review and pair programming as daily rituals. Finding and fixing problems immediately is the best insurance against the compounding effects of unpaid technical debt.
- Measure your technical debt. Measure your product’s technical debt to provide early warning signs of potential problems. Track metrics for code quality, code coverage, velocity rates, defect rates, defect resolution rates, and others. Automated tools are good for some of these.
- Reducing technical debt should be part of your culture. As Scott Ambler notes , technical debt isn’t going to fix itself. Encourage and empower developers to refactor code opportunistically, always leaving the code better off than it was before. Create an environment in which developers and management collaborate together on controlling technical debt. This requires open, honest, and frequent lines of communication, as well as a shared understanding of the benefits of keeping technical debt in check. Sometimes simple refactorings won’t be enough to reverse debt. For example, rewriting a back-end component in a different programming language. This is a strategic decision that requires a high level of trust and transparency between developers and management.
Congratulations, you’ve finished the guide! If you’re interested in learning even more about how to manage technical debt effectively in your software development projects, please check out our list of compiled resources.