Introduce Parameter Object
From CSSEMediaWiki
(Difference between revisions)
Brett Ward (Talk | contribs) (New page: What to do when you have a group of parameters that naturally relate or fit together. ---- '''Example:''' amountInvoicedIn(Date start, Date end) becomes amountInvoicedIn(DataRange ran...) |
Jenny Harlow (Talk | contribs) (merge with 'replace parameter object', add ref to long parameter list smell) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
− | What to do when you have a group of parameters that naturally relate or fit together. | + | What to do when you have a group of parameters that naturally relate or fit together. This will help make parameter lists shorter and easier to understand ([[Long parameter list smell|long parameter list smell]]) and will make it easier to modify if needed. |
+ | |||
+ | It can also help reduce [[Duplicate code smell]] by moving other behaviour to this new object | ||
---- | ---- | ||
Line 14: | Line 16: | ||
== See Also == | == See Also == | ||
+ | *[[Data_class_smell|Data class smell]] | ||
{{Refactoring}} | {{Refactoring}} |
Latest revision as of 04:06, 19 October 2010
What to do when you have a group of parameters that naturally relate or fit together. This will help make parameter lists shorter and easier to understand (long parameter list smell) and will make it easier to modify if needed.
It can also help reduce Duplicate code smell by moving other behaviour to this new object
Example:
amountInvoicedIn(Date start, Date end)
becomes
amountInvoicedIn(DataRange range)
with DataRange becoming the new "Parameter Object"
See Also