Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiple procedures vs. one procedure - revisited
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01022173
Message ID:
01022274
Vues:
12
>I think I agree with Cetin.
>
>I prefer to have classes, in one or more prgs, and then there is no need to ever use SET PROCEDURE TO, for example:
>
>
>
>* MyClasses.PRG
>
>define class StringFunctions as Custom && Or whatever, String related functions
>  function myStringFunction1(myParametersList)
>  endfunc
>
>  function myStringFunction2(myParametersList)
>  endfunc
>enddefine
>
>define class ArrayFunctions as Custom && Or whatever, Array related functions
>  function myArrayFunction1(myParametersList)
>  endfunc
>
>  function myArrayFunction2(myParametersList)
>  endfunc
>enddefine
>
>define class DataFunctions as Session && This are functions that will use tables, thus I use Session as baseclass
>  function myDataFunction1(myParametersList)
>  endfunc
>
>  function myDataFunction2(myParametersList)
>  endfunc
>enddefine
>
>
>Then in programs or forms or classes
>
>
>loDataFunctions = newobject('DataFunctions', cSomeBasePath + 'MyClasses.PRG') && or
>thisform.DataFn = newobject('DataFunctions', cSomeBasePath + 'MyClasses.PRG')
>...
>loDataFunctions.myDataFunction(someParameterList)
>
>
>This way you get rid of SET PROCEDURE altogether, and with that you get rid of some code, for example you do not need to store the current set("procedure") at the beginning of some processs and then restore it back at the end, something you should do, in particular if there are chances that the PRGs have some common named functions
>

This looks like a very interesting idea. The only problem is that MereMortals automatically adds every function, which is added to the project, into the SET PROCEDURE. It does the same with the class libraries using classlibs. So your solution would not work in MereMortals environment.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform