Replace Parameter with Explicit Methods
From CSSEMediaWiki
(Difference between revisions)
(Removing all content from page) |
|||
Line 1: | Line 1: | ||
+ | This is used when you have a method which switches based on a passed in parameter. | ||
+ | ==Steps== | ||
+ | * Create a new method for each case | ||
+ | * Replace all calls to the old method with a call to the relevant new one | ||
+ | * Delete the old method | ||
+ | |||
+ | ==References== | ||
+ | * [http://sourcemaking.com/refactoring/replace-parameter-with-explicit-methods] |
Revision as of 06:08, 25 September 2009
This is used when you have a method which switches based on a passed in parameter.
Steps
- Create a new method for each case
- Replace all calls to the old method with a call to the relevant new one
- Delete the old method