5 ms·
I'd think that such a solution doesn't solve but merely moves the problem. A method with N arguments, where N > 2, with a call that is messy due to the number
by webignition 6y ago
I'd think that such a solution doesn't solve but merely moves the problem.
A method with N arguments, where N > 2, with a call that is messy due to the number of arguments could instead take a single argument being a parameter object where the constructor for the parameter object takes the same N arguments.
A constructor with N arguments with a call that is messy due to the number of arguments ...
- SAI_Peregrinus 6y agoAah, so then you use the Builder Pattern! Instead of one constructor taking N arguments, have a constructor that takes no arguments and N function calls to initialize the constructed values. It's cleaner because it's a named pattern! /s