Re: global variable not being recognized by script object su
Re: global variable not being recognized by script object su
- Subject: Re: global variable not being recognized by script object su
- From: Chris Nebel <email@hidden>
- Date: Wed, 28 Feb 2001 12:02:51 -0800
- Organization: Apple Computer, Inc.
Arthur J Knapp wrote:
>
> And I don't need to use funny Microsoft names (like "gStrMytext") to protect
>
> myself against accidental bumping together of names in the global name space,
>
> because there's nothing to bump.
>
>
In recent months, I have become especially fond of using gStrEtc...
>
type variable names, ie: descriptive of both scope and type. I find
>
that when I go back to re-examine complicated scripts that I had
>
written several months ago, that the variable naming conventions
>
are helpful.
>
>
If this type of thing is truly of Microsoft invention, then it may
>
be the only darn thing of use that they have ever done. ;-)
Microsoft didn't invent this sort of thing, but they did refine a particular
species of it known as Hungarian notation -- see
http://msdn.microsoft.com/library/techart/hunganotat.htm. Interestingly, scope
prefixes (e.g. "g_" for global, "m_" for member fields, etc.) are not part of
Simonyi's original notation. It's more concerned with the type of variables.
For example, if you know that "co" means a color type, then you can tell at a
glance that "mpcopx" is an array of pointers-to-x indexed by color. Proponents of
Hungarian notation claim that it makes code significantly easier to read, write,
and comprehend, and therefore reduces bugs, especially in multi-person projects.
Detractors claim it takes a normally good technique and rides it mercilessly into
the ground.
--Chris Nebel
AppleScript Engineering