Sometimes, rewriting and modernising code just isn't an option. When this happens, refactoring is one of the best options.
Being able to enter a totally unknown area of code, understand it, work with it and extend it, is a valuable coding skill.
James recommended the Gilded Rose kata as a great way to practice refactoring.
I wholeheartedly recommend spending some time working through the Gilded Rose kata using the approach described while making sure to stick strictly to the defined rules. It’s a great, if not slightly contrived example of refactoring legacy code.
You won’t fix everything that's wrong with this code and that's ok. After the most complex part of the system looks a little better, the rest becomes trivial. If after working through the kata, you are still not sold on the approach, try doing it again, but add the “conjured items” feature first. Which approach did you prefer?
The Gilded Rose kata is aimed at extending the skills of the competent developer focusing on Property Based Testing and Legacy Code.
Getting set up can be the roadblock to starting a kata. In our screenkatas you can join our Software Craftspeople and let them show you how to set up your repositories for Java, PHP, Python and Typescript. For other languages, check out our guide on GitHub.