Replace Conditional with Polymorphism

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
 
----
 
----
 
Straight from [[Martin Fowler 1999]]:
 
Straight from [[Martin Fowler 1999]]:
Line 7: Line 6:
 
''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==
+
>==Similar==
  
 
[[Extract Hierarchy]]
 
[[Extract Hierarchy]]
 +
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://ahowulumus.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 +
----
 +
=[http://ahowulumus.co.cc CLICK HERE]=
 +
----
 +
</div>

Revision as of 02:30, 18 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."

>==Similar==

Extract Hierarchy


Personal tools