This is the second blog in a two-part series on managing tech debt on agile development teams. The first blog, Repaying Tech Debt with Sprints, Handoffs, and Hackathons, discusses steps teams can take after tech debt has piled up. This blog will focus on how to prevent tech debt from occurring on your engineering team.
“We are what we repeatedly do. Excellence, then, is not an act, but a habit.” Aristotle usually gets the credit for this quote, but it’s actually from philosopher, Will Durant, who tidied it up a bit for him.
Everyone knows how important it is to keep good habits. Who hasn’t avoided doing the laundry a couple of times, only to find that a heap of dirty clothes has taken over the house?
This applies to tech debt too. We all know we need to stop it from building up. But much like laundry, it’s an important and necessary task that many of us tend to put off. And like those real-life situations, one of the most important factors in addressing tech debt is mindset: having the determination and dedication to keep it down is critical.
But beyond mindset, having the right tools and a supportive environment are often the difference between a clean house and an increasingly smelly pile of problems. Make it as easy and simple to do as you can, and you’re that much more likely to actually do it. For developers working within the Agile framework, this means taking advantage of the flexibility and compartmentalization of the sprint format.
How to prevent technical debt
Here are our tips for how to be proactive and stop tech debt before it happens, preventing developer headaches, lost development time, and issues with your code breaking.
1. Tackle tech debt as you go
A little bit of work on a regular basis adds up to a big result over time. So, the simplest approach to addressing tech debt is to just tidy as you go. In the process of building a new feature, it might be worth taking some time to look at existing components, says Aaron Franks, Senior Frontend Engineer at ZenHub. “Examining existing code can reveal problem areas, like convoluted logic. Simplifying that logic might not help with your deliverable, but it helps make sure things are maintainable down the road.”
Of course, if you’re aware of shortcomings in the code or opportunities for improvement in advance, it’s easier to fit them into your schedule. That’s where planning poker estimation tools come into play. Estimating timelines in advance makes it easier to add a bit of time to work on eliminating tech debt or avoiding the bottlenecks that tend to create it in the first place.
“When you’re estimating time for something you’re not sure about or a new task,” Aaron says, “budget a small amount of time to do a "spike" to see if your approach is feasible.” This helps avoid the time crunch that often leads to the creation of tech debt.
Continuous integration is critical to all of this. “Everyone knows that they need to be constantly merging code and testing it to make sure everything is working, but long-running integration branches can pose a challenge when they need to get merged back in,” Franks adds. It’s tempting to put off merging and testing, but if different code contributions don’t play nice together, then suddenly you’ve got a lot of tech debt on your hands.
2. Use code reviews to ensure quality code
While tidying up as you go is important, like it or not, everyday maintenance by itself won’t keep tech debt down. Deadline crunches and unexpectedly tricky problems can easily lead to tech debt build-up.
That’s why targeted efforts, like code reviews, are so critical. “It’s hard to overstate the importance of code reviews,” Aaron says. “You catch a lot of design issues and other general problems with them.” This also makes it important to have tools that help make the process easier. So, Franks says having a powerful code review system is “extremely important.”
A coverage tracking tool that makes it easier to track your efforts is also very helpful. By generating reports on how many lines of code were executed and when tests were run, a coverage tracking tool gives an overall picture of code coverage. “That’s important to see if we’re making progress, or if we’re backsliding on certain areas of the code base,” Franks says.
Documenting why code was written a certain way can also be invaluable. Over time, development teams lose institutional knowledge. If down the road someone tries to change code because they don’t know why it was created the way it was, that can lead to a lot of tech debt that didn’t need to exist or even break something.
And while Agile as a format has a ton of strengths, when deadlines are looming, tests tend to be the first thing to get cut. Pushing for test-driven development as a strategy can be worth it, Aaron says. “It’s not always the appropriate approach, but testing is part of the process by default for a reason: it’s how you tell the difference between functional code and tech debt. And the sooner you test your code and catch any tech debt, the easier and faster it is to fix it.”
3. Make sure developers have a supportive culture
None of the described approaches to tackling tech debt have any value if developers are the only people who believe mitigating tech debt is important. These approaches and the tools that support them fundamentally require a time budget that doesn’t always exist. According to Aaron, “if developers are feeling the pain from tech debt, they need to advocate for having the time and budget to whittle it down and be preventive about it.”
Aaron acknowledges that getting non-developers to agree on sacrificing in other areas to address tech debt can be a challenge, so “developers need to advocate for themselves when it comes to tech debt. Non-tech people don't feel the acute pain of tech debt like developers do, so developers need to be clear that tech debt hurts the team's long-term velocity.”
ZenHub helps free up time for minimizing tech debt
Having the right tools won’t solve all of your tech debt problems, but it will make it easier to deal with them. ZenHub capabilities, such as automated sprint planning and planning poker, can save you time and effort in other areas, leaving it available for implementing these best practices for reducing tech debt. After all, if the laundry’s the only chore, it’s a bit easier to manage.
For those times when tech debt has built up, check out the first blog in this series on tech debt: different ways to repay tech debt.