Where Can I Find Messy Codebases to Practice Refactoring?

September 16, 2026 4 answers
Asked by MellowCedar42
I'm looking for real-world codebases that are messy enough to provide useful refactoring practice. I've already worked through a few coding katas, including the Golden Rose and Tennis katas, and would like to try something closer to an actual project. Ideally, the codebase would be somewhere around 1,000โ€“5,000 lines so it's substantial but still manageable. Are there any open-source projects, deliberately poorly designed examples, or other good sources you'd recommend?

Answers

SunnyMaple16
Another option is to have a code-generation tool create a small application from vague requirements, then treat the result as a refactoring exercise. It can produce inconsistent naming, duplicated functionality, oversized functions, and weak separation of concerns. Just make sure you understand the code first and add tests before making larger structural changes.
Reply to this answer
BrightOtter7
Open-source projects are probably your best bet. Pick a small project in a language you know, get it running, and spend some time understanding the tests and behavior before changing anything. Then look for focused improvements such as extracting responsibilities, reducing duplication, improving naming, or simplifying conditionals. The exact line count matters less than whether you can run the code and verify that your changes preserve its behavior.
Reply to this answer
CopperMeadow88
You donโ€™t necessarily need a project specifically labeled as spaghetti code. Most active codebases contain a few areas that are awkward or overdue for cleanup. Choose a small open-source repository, identify one well-contained problem, and refactor it incrementally. A codebase of 1,000 lines may not be terribly tangled, while a smaller project can still have plenty of design problems.
Reply to this answer
QuietLantern3
A personal project can become excellent refactoring practice. Build something quickly, leave it alone for a few weeks, then return and try to extend it. Youโ€™ll usually discover unclear abstractions, duplicated logic, and design decisions that no longer fit. That gives you realistic practice because you have to improve the structure without breaking features you still need.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions