Code smells
Long Parameter List: Introduce a Parameter Object
A long parameter list is a method that takes so many values that every caller must line them up in the right order. The values often travel in groups, called data clumps, and each clump can become one small type, a parameter object. These lessons take a shipping quote with nine parameters, introduce an address and a parcel one step at a time, and turn a new fragile surcharge into three edits where the value is made or used.
Pick your language
When to use it
Use it when
The same group of values goes, in the same order, through several methods.
Skip it when
A method takes three or four unrelated values used only there, like a log call with a level, a message and an error.
Spot it by
The same names repeated across signatures, runs of same-typed arguments, a method that only passes its parameters on.