DIP 1020--Named Parameters--Community Review Round 2
JN
666total at wp.pl
Wed Sep 11 08:16:42 UTC 2019
On Wednesday, 11 September 2019 at 05:37:57 UTC, rikki cattermole
wrote:
> This is a known code smell with a known solution: refactoring.
>
> I will posit that if you have code that has long parameters
> lists often, either you have a lot of technical debt or you are
> writing code that lends itself to introducing technical debt
> often.
>
> For me at least, when I have long parameter lists, they
> typically involve math and are called in about one or two
> places at most and quite importantly all done within the same
> module. I do not believe that this warrants a language feature
> in of itself but I can be convinced that there are problems
> that lend itself to long parameter lists that are often solved.
Long parameter lists usually aren't a code smell, and personal
opinions and preferences are not enough to refute it. The
alternative to long parameter lists is the Builder OOP pattern,
which also usually isn't a code smell. Some records/objects just
have many members and it doesn't make sense to split them up into
smaller groups.
More information about the Digitalmars-d
mailing list