A lot of frameworks, most like jQuery plugins uses the "optional" parameter. Basically a dictionary (or key/value structure) with a bunch of additional parameters instead of send in the parameter's function.
As an example:
function (param1, param2, param3, param4, param4) {
...
}
Is replaced for:
function (opts) {
opts.param1
opts.param2,
opts.param3
...
}
IMO using opt
is almost equal to use a lot of parameters in the constructor.
I think is a little hard to maintain the configurations (sometimes) and understand what is inside of it.
Maybe it is for non typecheck of javascript, and the IDES normally doesn't help easily to know what is inside of opt.
But I don't know how to improve the creation of a configurable object.
Someone knows better solution or how to improve the design in this situations?