Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best approach about #DEFINE constants
Message
De
16/05/2008 09:59:52
Mike Yearwood
Toronto, Ontario, Canada
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01316940
Message ID:
01317617
Vues:
14
>>Well, you've gotten several replies. You've already learned that privates at the top level are almost identical to public. However, the danger with public and even with pseudo public private variables is the ability for any running code to overwrite the content of the variables, with possibly drastic impact throughout the system.
>>
>>I saw such a thing once. It was a fatal flaw - literally. The system would have resulted in a patient deaths all because of changing one public variable.
>>
>>I think an application object which reads a table or ini file to get the initial values and makes the values read-only is safest. Such an object could be declared at the start of the app with private or public or bound to _screen. It could instantiate a parameter object used to hold the "public" variables. All values would be protected and accessible via get/set methods.
>>
>>If some code removes the application object, an error handler could shut the app down or reinstantiate the application object and the "public" variables.
>
>In other words, we're back to using one global object which you objected at your original reply.

Not at all. I said leaving the properties on such a public object public is no better than public variables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform