Ever read the book Refactoring? It covers the topic of refactoring long parameter lists.
The following points are made:
- Methods can query other objects' methods internally for data required to make decisions
- Methods should depend on their host class for needed data
- We should pass one or more objects to simplify our call signature
- We should use a technique called replace parameter with method to reduce the number of required parameters
- Pass a whole object with required attributes to reduce the number of required parameters
- Use a parameter object when we have unrelated data elements to pass
- We can send separate parameters when we do not want to create a dependency on a larger parameter object; this is an exception and ...