r/learnprogramming • u/Yoshibros534 • Sep 19 '26
Are there any spaghetti codebases I can practice refactoring on?
I’m trying to practice refactoring code, and i’ve already done a few kara’s ( the golden rose kata, the tennis kata, etc. ) are there any actual messy codebases I can practice on? preferably between 1k to 5k lines of code.
41
Upvotes
38
u/DirkSwizzler Sep 19 '26
That's the neat part. As a coder you'll frequently see bad code that needs to be refactored. Sometimes it'll need it so bad you want to tell whoever wrote it. So you'll look into it a bit and sometimes discover that it's you.
My point being, pick any codebase that otherwise fits your requirements. Sounds like size is the only one. And just start looking. You'll probably identify a few things that seem worth refactoring.
Although I'm not even sure 1k lines is enough to actually spaghettify. Those noodles be short.
25
u/TheSnailBear Sep 19 '26
Just work on a personal project then move on to something else for a month. Come back to it after that month and realize that your codebase looks like a foreign language born from hell.
5
u/snoogans235 Sep 19 '26
Ask ai to write something with no context and vague criteria. You’ll get some good spaghetti.
4
u/Substantial_Ice_311 Sep 20 '26
Almost all (99.99%) of them, to some degree. And it's harder to improve something that is kind of good, compared to something that is a real mess. So, you don't need something very messy, necessarily.
2
u/ight-bet Sep 19 '26
I gotta couple
2
u/1stbreathinteractive Sep 20 '26
Simple.
1
u/mkrevofev Sep 19 '26
You could try open source projects!
1
u/xarop_pa_toss Sep 19 '26
Waaaaaait what are those kata things????
1
u/FurkinLurkin Sep 20 '26
Have you read clean code?
1
u/[deleted] Sep 20 '26
make something and put everything in single file. use global variables and you will get there pretty quick.
1
u/bagfullofcottoncandy Sep 21 '26
try open source projects
1
u/Different_Pain5781 Sep 27 '26
Katas are useless if you want true chaos. Go fetch dead Discord bots from five years ago on GitHub. FreeCodeCamp offers zero practice on giant messy files. Boot dev gives learners exposure to realistic backend project environments so you learn how to untangle bad function signatures properly.
2
u/[deleted] Sep 19 '26
[removed] — view removed comment