Back to Catalog
Code Smells
Bloaters
Long Parameter List
Methods with too many parameters are hard to understand and use.
Intent & Description
'
π― Intent
Identify methods with long parameter lists that make the code hard to read and maintain.
π Context
You have methods that require many parameters, making them difficult to call and understand. Adding new parameters requires changing all call sites.
π‘ Solution
Replace parameter lists with parameter objects, or use the Introduce Parameter Object refactoring.'
Real-world Use Case
Use when methods have more than 3-4 parameters, especially when related parameters are grouped together.
Source
π TL;DR
Too many parameters make methods hard to use. Group related parameters into objects.