The long parameter list code smell ๐ happens when method signatures require long lists of parameters. They may include, among other things, flag ๐ฉ parameters, which are a specially bad ๐ pattern. Flag parameters are used solely to determine which conditional path the method must execute, and make it much harder to figure out the method's overall behavior and intention.
Why is it bad? ๐
Long parameter lists are harder ๐ซ to maintain. For example, making intermediary parameters optional is a specially difficult task to achieve in most languages.
If we pass parameters in the wrong ๐order, we may very likely break ๐จ the function. It becomes increasingly difficult to figure out a function's invocation the longer its parameter list gets.
How to fix it? ๐ก
Substitute data parameters with a single data object ๐ parameter.
If it's possible to obtain information about another parameter from a parameter, remove โ the additional parameter.
Avoid passing flag ๐ฉ parameters.