Reduce the number of arguments
From CSSEMediaWiki
(Difference between revisions)
Line 3: | Line 3: | ||
The creation method is made as an exception for this role. | The creation method is made as an exception for this role. | ||
− | = See Also = | + | == See Also == |
* [[Long parameter list smell]] | * [[Long parameter list smell]] |
Revision as of 08:38, 8 August 2009
A method with a large number of arguments can be very hard to read, such a method should be considered for redesign. A method which requires a large number of arguments can be broken down into several methods with fewer arguments. Another way to overcome this problem is to encapsulate all of the arguments into a separate entity, for instance a class, then pass the class around rather than the individual attributes.
The creation method is made as an exception for this role.