Replace Conditional with Polymorphism
From CSSEMediaWiki
(Difference between revisions)
m (Reverted edits by Ebybymic (Talk); changed back to last version by Warwick Irwin) |
|||
Line 1: | Line 1: | ||
+ | |||
---- | ---- | ||
Straight from [[Martin Fowler 1999]]: | Straight from [[Martin Fowler 1999]]: | ||
Line 6: | Line 7: | ||
''Move each leg of the conditional to an overriding methos in a sub class. Make the original method abstract.''" | ''Move each leg of the conditional to an overriding methos in a sub class. Make the original method abstract.''" | ||
− | + | ==Similar== | |
[[Extract Hierarchy]] | [[Extract Hierarchy]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 03:23, 25 November 2010
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."