r/ProgrammerHumor • • Sep 23 '22

Refactoring "Just working solution ".

Post image
54.8k Upvotes

355 comments sorted by

View all comments

3.1k

u/TerriblyCoded Sep 23 '22

Past me: “Hahaha! I’M A GENIUS!”

Present me: “OH NO!”

33

u/[deleted] Sep 23 '22

For me that's simplifying the code, I untangled and simplified one big function and now it turns out I'm slowly adding special cases into it back again. Ehh, it was a mess and it's slowly becoming a mess again.

17

u/Kyouma118 Sep 23 '22

Well there's a limit to how much you can simplify something. Sometimes spaghetti code is the only answer.

1

u/BetterOffCamping Sep 23 '22

No, it is never the answer. This is when you look at your index of design patterns, and figure out if one of them will handle these special cases. For example, strategy pattern or chain of command pattern.

→ More replies (1)