Replace Conditional with Polymorphism

From CSSEMediaWiki
Revision as of 06:27, 21 September 2008 by Jason Clutterbuck (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 methos in a sub class. Make the original method abstract."

Similar

Extract Hierarchy

Personal tools