Parameterise Method
From CSSEMediaWiki
Revision as of 22:05, 14 October 2009 by Brett Ward (Talk | contribs)
If methods are essentially the same but the values contained within the methods are different, they should be turned into a single method that uses a parameter to define these values.
A common example would be something like taxes. Methods may be made representing the tax brackets (eg applyTaxCodeM(), applyTaxCodeML()) but this produces duplicated code and would more easily be refactored into one method (applyTax(amount))
See Also: