Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Public variables
Message
De
13/06/2002 16:05:04
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00667392
Message ID:
00668214
Vues:
28
>>George, that's clever and I'll certainly use it whenever appropriate (appropriate according to me). However, I see one problem. Jim Booth stated (in other words) that we must guarantee that all variables get out of scope when the application ends, in order to prevent interference in a next run application. Added _screen properties won't get out of scope, so Jim would disagree with this usage?!
>>
>
>Peter,
>
>I don't disagree with any useage. I might not like it.
>
>I have a basic belief related to breaking rules.
>
>1. Know that there is a rule
>2. Know what the rule is
>3. Know what the price is for breaking the rule
>4. Know that the price for NOT breaking the rule is higher than the price for breaking it
>
>If you meet all of these criteria then by all means break the rule. If any piece is missing, well you will very likely have problems down the road by breaking the rule.

Hi Jim, I didn't see that you were online. See eventually also my reply to George.

I get the impression, whenever I see other people's code, that it has become kind of a 'rule' to declare certain variables public in the main program. Most notably these variables are used to reference one or more objects! Those objects may be 'managers' and 'the application object'. In an application I currently work on, I have a public variable for each possible form, e.g. goMainWindow, which is initially declared NULL and is used when I invoke that form:
do form mainwindow name goMainWindow
This enables me to test for its presence in the menu: skip for not isnull( goMainWindow )

This pattern (yes, that word now suddenly comes to my mind as very appropriate) satisfies a certain need quite well and it has certainly become a real rule in MY programming practice. What's more important is that I/WE should DOCUMENT, DOCUMENT and DOCUMENT those rules!
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform