Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is 20 parameters too many?
Message
From
06/02/2017 13:48:57
 
 
To
06/02/2017 13:26:42
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01647608
Message ID:
01647610
Views:
82
>Hi,
>
>I seem to recall a recent thread of number of parameters being too many or not. I am refactoring a routine where a method (called from various parts of the program) will have up to 20 parameters. The reason for so many parameters is that this method is called from different routines. And the method need some but not all values passed (depending on calling routine). My question is, what is the real downside of having so many parameters (if any)?
>
>TIA

The real problem with so many parameters, is trying to remember them all, and in which order they must be entered.

Depending on the situation, a common method with different wrappers may be a better idea. The wrappers may have only a few parameters, and set different default values for the others. Also the wrappers won't pass the different values to the common method as parameters. Instead it will create an object which will be passed to the common method. This solution will be much easier to extend, maintain and debug.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform