It is not. I've done it. Once you understand the complicated mess (often a big ball of mud or spaghetti code) you can identify the edge cases.
With an understanding of core design patterns, the core logic can be simplified, while edge cases can be moved to independent classes with a strategy pattern, chain of responsibility, adapter, or some other pattern.
Sometimes it can't be done that way, of course, but one usually can better clarify the edge case visibility and group it at the very least.
Edit: automated tests must be built that verify the new version output matches the old output.
6
u/BetterOffCamping Nov 25 '22
It is not. I've done it. Once you understand the complicated mess (often a big ball of mud or spaghetti code) you can identify the edge cases.
With an understanding of core design patterns, the core logic can be simplified, while edge cases can be moved to independent classes with a strategy pattern, chain of responsibility, adapter, or some other pattern.
Sometimes it can't be done that way, of course, but one usually can better clarify the edge case visibility and group it at the very least.
Edit: automated tests must be built that verify the new version output matches the old output.