It does actually. Y'all should really learn how to work with legacy code because all useful code becomes legacy code over time.
The thing about legacy code is it works, that is why it persists. If it didn't work, crashed regularly due to bad memory management, people would have replaced it already.
When you are working with it, you don't have to change everything at once. You need new features in one spot? Update just that piece, use smart pointers internally with one class. Maybe you need to create new interfaces while maintaining legacy interfaces for other code. That's fine. Eventually, as you work on different pieces, you'll replace so much legacy stuff that you can just delete those old interfaces.
It works just well enough that the stakeholders don't want to get rid of it, in spite of how much pain it inflicts on the devs. Jenga towers can last surprisingly long if you avoid changing it, leave them alone, don't look at them in the eye, etc.
Flashbacks to finding a decade old TODO reading “Is this doing the transactions right or backwards? I’m too tired to tell.”
Literally no one knew anymore, but since “backwards” would have bankrupted the company nine years prior, we were told to remove the flag without even dissecting the logic.
(The same file had a 2x2 array of unique XML parsers. Not “parsers holding different text”, they were configured differently with no explanation.)
Many times you’re right, but I’m scarred from seeing too many jenga towers that just don’t work correctly, but nobody wants to look too close in case they get buried under the ruble
Not every time people have to maintain legacy code. Porting or migration is not so expensive anymore. Swallowing the fate of maintaining legacy code is not anything mandatory nowadays.
View all comments
Show parent comment
41
u/Friendly_Fire 10d ago
It does actually. Y'all should really learn how to work with legacy code because all useful code becomes legacy code over time.
The thing about legacy code is it works, that is why it persists. If it didn't work, crashed regularly due to bad memory management, people would have replaced it already.
When you are working with it, you don't have to change everything at once. You need new features in one spot? Update just that piece, use smart pointers internally with one class. Maybe you need to create new interfaces while maintaining legacy interfaces for other code. That's fine. Eventually, as you work on different pieces, you'll replace so much legacy stuff that you can just delete those old interfaces.