Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
As a member of the society of Variadic Functions, I can identify with this rant...
-
"You're allowed to write functions with 1, 2, 3 or infinite arguments, but nowhere in between."
-
Root823424yUgh. I was guilty of this at one point, too. I had a constructor with like 20 params. I have no idea why I thought it was a good idea. 🤦🏻♀️
-
@wicho how is having 8+ parameters bad practice if you have named or optional parameters
-
wicho25674y@calmyourtities That means your function is doing too much and/or its context is to open.
I think it breaks the "do one thing and do it well" philosophy.
Also that's why you have object attributes and all that sweet POO stuff.
Not written in stone, I look forward to read your opinion -
@wicho actually, i’m more referring to object constructors rather than functions. i agree in most cases functions should have few parameters. in flutter a fair amount of classes have constructors with 15 or more arguments, and they work well in my opinion. in the backend however, unless it’s a config function, most functions should have less than 5 parameters.
-
wicho25674y@calmyourtities I agree, but you can always abstract it enough to have max 3 params. But it is the same as db normalization too much or too little is a matter of context or situation.
Coworker writes functions accepting 8+ arguments, thinks it's ok
devrant