Refactoring – Not on the backlog is a great read, and advises you to improve your code with every feature request you complete, instead of making it worse. The key is to refactor iteratively as you work.

We took this “gradual refactoring” approach at DeviantArt and I highly recommend it. You also get the side-effect of maintaining developer morale since large, long-lived codebases are often soul-crushing things to maintain.

So please, stop plowing through your tickets. Take a look at the code around you. Does it make sense? Can you make it more inviting to future devs or your future self?

When you estimate your tickets be sure to add some extra time for cleaning up any dirty spots you encounter. Implement your feature, understand the surrounding code, and polish things up a bit!