As developers we are always eager to learn new things and better ourselves at what we do.
You've all had moments when you look at your old code and get that feeling:
"WTH, I can't believe I used to write code like this"
Well, when it comes to long term projects that you're working on, what do you do when you look at your old code? You probably have learnt new techniques that you didn't use when you started the project. So you probably are very eager to refactor or restructure, or swap out modules in your project.
But when is the right time to do this, and how often do you do this? Also, there are risks involved if you do some major refactoring. There's also budget constraints so you may have the urge to make changes but your project manager won't give you the time to do so. How do people approach such situations?