Replace Conditional with Polymorphism
From CSSEMediaWiki
(Difference between revisions)
(New page: Straight from Martin Fowler 2003: "You have a conditional that chooses different behaviour depending on the type of the object. ''Move each leg of the conditional to an overriding me...) |
|||
Line 1: | Line 1: | ||
− | Straight from [[Martin Fowler | + | |
+ | ---- | ||
+ | Straight from [[Martin Fowler 1999]]: | ||
"You have a conditional that chooses different behaviour depending on the type of the object. | "You have a conditional that chooses different behaviour depending on the type of the object. |
Revision as of 02:58, 23 September 2008
Straight from Martin Fowler 1999:
"You have a conditional that chooses different behaviour depending on the type of the object.
Move each leg of the conditional to an overriding methos in a sub class. Make the original method abstract."