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...) |
Brett Ward (Talk | contribs) |
||
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 easier to understand 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 | ||
---- | ---- |
Revision as of 10:53, 14 October 2009
What to do when you have a group of parameters that naturally relate or fit together. This will help make parameter lists easier to understand 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