>>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
>
>It is not many, you can have up to 27 parameters (according to documentation). However, it is VFP and VFP doesn't support neither optional nor named parameters. You have to remember and fill many parameters. If say you need to fill first and last parameters only (and somewhat default values for others by passing empty values) you still need to pass all 20 parameters.
>
>An easier way would be to pass a single "empty" object with properties as parameters. Something like:
>
>
>local loParameters
>loParameters = createobject('Empty')
>Addproperty(m.loParameters, "ParameterName", "ParameterValue")
>* ...
>Addproperty(m.loParameters, "ParameterN", 1)
>
>MyFunction(m.loParameters)
>
>
>The receiver method could also modify some parameters and return them as output values.
Thank you. Something to consider. And thank you for the sample code.
"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