Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table from Array
Message
De
07/03/2005 08:53:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
07/03/2005 08:43:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00993044
Message ID:
00993255
Vues:
19
>I have two questions:
>
>1) Why are public variable such a horrible thing?

A public variable is a shared space, accesible from all programs. This makes it hard to control your program. Some procedure might unexpectedly do a change, and you will have a hard time finding out which one it was.

>2) If they are as bad as so many developers claim, why are they part of VFP?

In some cases, they are unavoidable. For example, you do need some public variables, to store information about your application in general, accesible from different procedures, forms, etc.

However, since an object can contain many different variables (properties) a single "application object" might be sufficient to store all your global data.

Also, in some cases it is tricky to exchange data between forms; a global variable can be an easy solution. But it is preferable to search for alternative methods.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform