### Article de blogue

# Tales from a coaching session: Addressing debt strategically, not upfront

5 February 2025

> _..but Nick. How would you address all this debt we have in our test coverage? We have like 40% code coverage. Tops. And it’s not improving._  
> _Interesting. I also wish for it to be higher. How do you think you could improve that?_  
> _I was thinking about maybe adding a tech debt PBI to our backlog. I could estimate the R.O.I, sell it to our PO, maybe get it prioritized next quarter. It would be fun and it could really help us. What do you think?_  
> _It’s interesting. Would you be willing to explore different scenarios w/ me?_  
> _Sure…._  
> _Let’s draw up the current state of affairs._

Initial state: 40% code coverage

> _Let’s suppose the code coverage is evenly spread throughout the app_

Given an even code coverage distribution

> _Suppose your initiative comes to fruition and you manage to improve coverage by 50%. That would bring it up from 40% to 60%._  
> _Enough to bring out the champagne! 🍾_

From 40% to 60%. Hurrah!

> _After waiting all this time, business has plenty of new ideas._

Super genius!

> _You start working on a new feature. You can expect the tested paths for the code affected by the new feature to be roughly ~ 60%_

60%: 50% better than before.

> _A major improvement over your previous situation correct?_  
> _But not quite our target…. Man….How do we get out of this?_  
> _Stay with me. Here is an alternative:_  
> _You. Pay. Off. Zero. Debt. Up. Front. None. Nada._  
> _What?! But Nick…_  
> _Wait. There’s a trick. When PO comes in w/ a new idea, you cover each small area of code you are about to change via_ [_characterization tests_](https://en.wikipedia.org/wiki/Characterization_test) _JUST PRIOR to working on that part of a new feature…_
> _Won’t that delay delivering the feature? Increase the estimate?_  
> _It depends. But if it does, probably not by much given the benefits of the newly added tests on preventing regressions._  
> _Also, these may give you the required confidence to make the adequate_ [_structure changes_](https://medium.com/@kentbeck_7670/bs-changes-e574bc396aaa) _that make the_ [_new feature easier to introduce_](https://x.com/KentBeck/status/250733358307500032?lang=en) _._  
> _Right._  
> _Now after the introduction of the change, things look a bit like this_

100% coverage from feature-focused efforts

> _As time goes, your code coverage map would eventually look a little something like this._

Onwards and upwards!

> _And this comes w/ the added benefits of not having to negotiate, plan & estimate the debt._  
> _It also prevents the need for you to try and find a crystal ball to plan the future and what code may have to change or not._  
> _Willing to give it a try?_  
> _Sure!_
