Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variable/field naming conventions
Message
 
À
26/03/2007 16:42:42
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01208623
Message ID:
01209003
Vues:
14
A pox on Hungarian notation! I think I'm in the minority on that in the VFP community, but I stand by it and am ready to duel to the death on it (as long as you're near-sighted and remove your glasses or contacts, plus your gun can't be loaded, and I count five paces and you count ten . . . did I mention my Kevlar vest? <g>).

I strongly believe in the *readability* of code. Someone here told me that HN made it more readable, but he didn't understand readability vs. understandability (is that a word!?). I much prefer RecordCount over nRecord. It works *with* my brain, not against it. We have been reading standard English since childhood and I like my code to look somewhat like that (sorry to the non-English speakers, but VFP is written in "English" and I can't change that one - and don't want to!). So instead of cCustNum, I might use CustNumStr. I once saw a point/counterpoint article on HN in FoxPro Advisor. YAG was giving the "pro" argument. He addressed readability and said how once you use it for awhile, you don't see those prefix letters. Exactly!! Because your brain wants to read "normal" text it will start looking past them. When you do that, what's the point? When you do that you start getting code like this lcVar = 5.00. I've seen code like that in M$'s code. HN is a poor solution to a problem.

Better, more descriptive, and (usually) longer variable names are a better solution as are proper parameter passing (and the names of parameters), increased code granularity, and better commenting.

I seem to see HN elsewhere, but I'd love to see less of it. It's my understanding that it's not actually in favor at M$. I hope that's true.


>Now more and more of us are using more than one development language and/or database environment, I would be interested to know what you developers out there are doing regarding continuing the 'established' VFP standard of prefixing field names with the first letter of the datatype (c for character, n for numeric, l for logical, etc.) when you are working with other software.
>
>I am so used to it now that cFirstName, cSurname, cAddress1, etc. come more naturally to me than firstname, surname, address1... The more I look at other developers' work, or on-line demos in other languages, I have not noticed the convention used anywhere else apart from the VFP community. It's a pity it hasn't been adopted more widely. Is it used anywhere else?
>
>So...
>Are you keeping up the standard, and applying it to other development environments (ie. spreading the word, and the advantages)?
>Are you keeping up the standard for VFP only, but not for SQL-Server, C#, VB.NET, PHP, etc.?
>Have you abandoned (or not adopted) the notation in VFP because no-one else outside of VFP uses it?
>
>Any thoughts would be appreciated.
>
>
>Alan
eCost.com continues to rip people off
Check their rating at ResellerRatings.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform