Timeline for Are there guidelines on how many parameters a function should accept?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 29, 2018 at 16:40 | comment | added | Michael Durrant | I have given the source. Funny no comments since then. I have also tried to answer the 'guideline' part as many now consider Uncle Bob and Clean Code to be guidelines. Interesting that the hugely upvote top answer (currently) says not aware of any guideline. Uncle Bob did not intend to be authorative but it somewhat is and this answer at least tries to be an answer to the specifics of the question. | |
Sep 2, 2014 at 11:58 | comment | added | Michael Durrant | See Uncle Bob's argument at: informit.com/articles/article.aspx?p=1375308 and note that at the bottom he says "Functions should have a small number of arguments. No argument is best, followed by one, two, and three. More than three is very questionable and should be avoided with prejudice." | |
Sep 2, 2014 at 11:35 | comment | added | GreenAsJade | Are you seriously saying that ideally all functions would take no parameters? Or is this hyperbole? | |
Apr 19, 2012 at 13:31 | comment | added | Joshua Drake | -1 for not quoting the source | |
Apr 18, 2012 at 20:55 | comment | added | Donal Fellows | If a function has zero parameters, it's either returning a constant value (useful in some circumstances, but rather limiting) or it is using some concealed state that would be better off made explicit. (In OO method calls, the context object is sufficiently explicit that it doesn't cause problems.) | |
Apr 18, 2012 at 20:42 | history | answered | Michael Durrant | CC BY-SA 3.0 |