Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
lungdart298313dFigure out the behaviors. Write tests to ensure it behaves that way. Start with the easy stuff, end with the important stuff.
Now start refactoring. -
TeachMeCode468913dStart SMALL! Broken but refactored code is worse than working but shit code lol. And @lungdart said, write tests, get the general behaviors sorted out and test the general behaviors and functionality.
-
Demolishun3093213dWhat happens when the legacy code fails tests it should pass? What if those quirks are relied upon?
-
jestdotty244413dkeep bashing your head until you untangle those earphone wires until it works idk
I generally figure out what things do, map everything important out in pseudo code, then throw out like 80% of the old codebase and make the code more concise
also people often write repeat algorithms in a bunch of places and don't realize it -
sjwsjwsjw144813di've always regretted being born but it's more intense when this is supposed to be a small & easy ticket
-
ars1362413dIf you can find what code gets called on what situation, it starts to become possible to extract code into functions you can unit test. It’s neigh impossible if it relies on thousands of god objects and their state, but it’s a starting point if you can get to the very smallest possible unit of code.
Setting the office on fire is a better alternative as well.
cant figure out how to refactor legacy code in any clean/acceptable way
rant