DEV Community

Discussion on: Code Smell — Too Many Parameters

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Because of JavaScript, I feel that one Object parameter might be preferred, rather than multiple, or varargs.

It makes ordering of params not to matter.

Collapse
 
pentacular profile image
pentacular

I think you may have missed the point of the post. :)

Collapse
 
habereder profile image
Raphael Habereder • Edited

How so?

If I see parameters like studentID, studentName, studentAge, etc. all of these could be grabbed from a single Student object. Even dependencies like classes and fees should be retrievable by the same object via references.

A single object as parameter, where applicable, makes the whole function easier to structure