Reduce the number of arguments

From CSSEMediaWiki
Revision as of 00:30, 5 October 2008 by Chen Qing (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A method with a large number of arguments can be very hard to read, such a method should be considered for redesigning. A method which requires large number of arguments can be break down into several methods with smaller 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 individual attributes.

The creation method is made as an exception for this role.

Personal tools