3 ms·
I think there is a point to "less function arguments is better". I think the real problem in your example isn't the number of arguments but passing separate va
by Silhouette 5y ago
I think there is a point to "less function arguments is better".
I think the real problem in your example isn't the number of arguments but passing separate values that logically belong together as a single coherent piece of data. You could make the same argument about passing a Point parameter for a 2D position instead of a pair of separate co-ordinates (and the argument would still be just as valid if you did).
Of course that isn't what Martin said anyway. He said the ideal number of arguments is zero, which is absurd. The ideal number of arguments is however many you need to pass in the relevant information for your function to do its job, hopefully in a representation that is clear and easy to work with. If he'd suggested that this will often be a small number because there are often more effective ways to represent the data in functions taking many arguments (and look, here are some examples of those ways) I might well have agreed with him.