Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variable Naming
Message
 
À
08/01/2000 18:21:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00315006
Message ID:
00315025
Vues:
30
>lcname is a local character
>pcname will never exist in my program, but it would be a public character

I think this notation is more standard

l local
p private
g global
t parameter

>Why should I bother?

It is self documenting. Without even knowing the purpose of the code you can tell both the type and scope of all the variables used. Some other resources.

"Visual Foxpro Codebook" by Yair Alan Griver
"Code Complete" by Steve McConnell
"Variable Naming conventions" Thread #218631 on 1999/05/13
"Nelson vs Griver in Feburary issue of FoxPro Advisor" Thread #77445 on 1998/02/09

>What is with prefixing variables with their types? It doesn't take me long to figure out (ie, no time) that if you are doing numeric manipulation to a variable, its a number!

With a naming convention there is no need to experiment or test for the type of a variable. It is always known.

>Wouldn't it be better to define prefixes for where I expect the variable to be used? That way, if I end up in a debugger somewhere, I can tell where the variables were first defined.

Not sure I follow.

>And, what if I am moving variables into fields and fields into variables... Its a lot more convienant to call the variable the same as the field.

I find that confusing. I would rather see
lnDaysOfRain = Weather.DaysOfRain
than
DaysOfRain = Weather.DaysOfRain
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform