DEV Community

Discussion on: List of Variables vs. Object

Collapse
 
shayd16 profile image
Shayne Darren

While this is great for functional composition and keeping code clean, I think it should be used with caution. One of the reasons as to why having too many parameters in a method is bad is that the method might be doing too much work, just because we reduce to total parameter count doesn't mean we will fix the underlying issue. Instead, rewrite/split the method into several methods that take fewer arguments.

Collapse
 
miku86 profile image
miku86

Hey Shayne,

I absolutely agree with you.
Methods should do one thing and too much parameters are a good hint that a method perhaps could be broken up into smaller methods.