This touches on why you might want to do it. I would add that handing in a flag to a method to add some if/then logic is also nasty and breaking the single responsibility principle too. It's not really breaking with the DRY principal to make a different slightly different copy. You break with DRY when you have strictly-the-same dupe code. The painful thing about the apple and orange workflow I give in the link here is that the workflow has to be updated in two places when a step is added. Ideally all of these mechanics are refactored into polymorphic solutions, but who actually does that? I've yet to work anywhere where the powers that be want to clean up that case/switch statement in a God class that is already working.
No comments:
Post a Comment