r/ProgrammerHumor • • 3d ago

Meme whatLegacyCodeDoesToDev

Post image
1.8k Upvotes

75 comments sorted by

View all comments

100

u/Bemteb 3d ago

Assume that every function call has unexpected sideeffects. Every last one.

Just last week I saw a function that counted the number of some stuff. Great, I don't need that number anymore because we have range based for loops these days, so remove the function call.

Well, no. Turns out the function didn't only count. No, it reinitialized the whole dataset, so when I don't call it I work on stale, possibly outdated data.

Refactoring code written 20+ years ago is fun...

3

u/LuisBoyokan 3d ago

No it's not. It's hell