Sooner or later we all have to inherit an existing code base full of complex, ugly code constructions that go on for pages and pages. Your boss asked you to do a ‘minor’ change to this codebase. You open up the hood to make this change and… you discover an enormous mess. Working on this kind of codebase can be tiring and joyless. But if you decide to make this code base better each day than it was the day before, you can change this awful experience in a joyful learning process.
That can mean refactoring a long method into several smaller, well named methods. It can mean removing inheritance hierarchies that never belonged in the object model. It can be fixing a long-broken unit test, and so on…
If you do these changes incrementally, they will come for “free.” Refactoring one method is something you can do in the time you would normally spend getting another cup of coffee or chatting with a co-worker about the latest news. And making one small improvement is motivating. You can clearly see the difference in that one thing you’ve fixed as soon as the change is made.
So if you start working on some dirty code, instead of complaining about it and introducing a quick work around, clean up the code a little bit so each time you have to open up this code base, it becomes better.