I recommend the first half of the Out Of The Tarpit paper.
1. Get the change to work
2. Refine the change to make it cleaner, less complex.
Most devs stop at #1. Trying to eke out every hour of developer productivity via Scrum is antithetical to #2 though.One other anecdote, me and a buddy were responsible for cleaning up a fairly sophisticated DSS scheduling system. The original dev left and a poseur came in and wrecked the codebase for over a year. Hospitals were cancelling contracts left and right and our cash flow was ... uh, short a lot. Our rule was if we ran across some bad code while working on our tickets: a bug, janky code, disorganized code, shit variable names, whatever, we fix it on the spot. We were able to do this because we had 3 month cycles and nobody breathing down our necks asking, "what did you do yesterday?" "why aren't all your tickets done this sprint?" Well it worked and we ended up with a clean scheduling system that was really nice after a few years and the company exited with a decent sale. I couldn't imagine a culture like this today.
0. Compose a new abstraction to describe the change.
And then at #2, the abstraction starts to get in the way.