Long Parameter List
Ruby supports positional method arguments which can lead to Long Parameter Lists.
Symptoms
- You can’t easily change the method’s arguments.
- The method has three or more arguments.
- The method is complex due to number of collaborating parameters.
- The method requires large amounts of setup during isolated testing.
Solutions
- Introduce Parameter Object⭐ and pass it in as an object of naturally grouped attributes.
- Extract Class⭐ if the method is complex due to the number of collaborators.