Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is 20 parameters too many?
Message
 
 
To
06/02/2017 13:48:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01647608
Message ID:
01647623
Views:
45
>>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.

Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform