Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is 20 parameters too many?
Message
De
06/02/2017 13:48:57
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01647608
Message ID:
01647610
Vues:
83
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform