Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public variable
Message
De
14/03/2011 01:48:34
 
 
À
13/03/2011 22:53:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
01503562
Message ID:
01503568
Vues:
74
>I use a lot of public variables using AddProperty()
>
>is there any disadvantage using too much public variables?

If you mean you're adding properties to a public, global object (sometimes called an application object, goApp) that's reasonably good practice.

How many are you using?

As long as you're following the general idea of not giving variables any more scope than they absolutely need, you should be fine. One example of how this can be a problem:

- Suppose you're running a form, but you choose to store some form-related information as properties of your goApp object

- Now, your app specs change, and it's possible you may have more than 1 instance of that form active at once.

In this case, it would be better to have custom form properties rather than adding them to your goApp object.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform