MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/xly172/refactoring_just_working_solution/ipm893o
r/ProgrammerHumor • u/VitaminnCPP • Sep 23 '22
355 comments sorted by
View all comments
Show parent comments
17
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. 1 u/nikniuq Sep 24 '22 I find in the real world a chain of responsibility pattern is overkill for a single function that needs to cater to a vendors penchant for edge cases.It should not be spaghetti but a bunch of clearly commented edge cases in a function is fine and often clearer than an overengineered alternative.
1
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.
1 u/nikniuq Sep 24 '22 I find in the real world a chain of responsibility pattern is overkill for a single function that needs to cater to a vendors penchant for edge cases.It should not be spaghetti but a bunch of clearly commented edge cases in a function is fine and often clearer than an overengineered alternative.
I find in the real world a chain of responsibility pattern is overkill for a single function that needs to cater to a vendors penchant for edge cases.
It should not be spaghetti but a bunch of clearly commented edge cases in a function is fine and often clearer than an overengineered alternative.
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.