Home All Groups Group Topic Archive Search About

Naming convention of Variables

Author
13 Sep 2006 12:58 PM
robear
A while ago, I found a web page that describe an array of naming
conventions when diming a variabe.

For instance:
tbl for table, str for string, i for integer.. (eg: tblMyTable,
strMyString, iMyint, etc)

I know there isn't a hard or fast rule of how your variable names
should be formed, but my real question is does anyone have any links to
web pages (M or other) that suggest types of naming conventions
(prefixes) for different types variables??

Thanks,
Robert

Author
13 Sep 2006 1:19 PM
Herfried K. Wagner [MVP]
<rob***@joshie.com.au> schrieb:
> I know there isn't a hard or fast rule of how your variable names
> should be formed, but my real question is does anyone have any links to
> web pages (M or other) that suggest types of naming conventions
> (prefixes) for different types variables??

Naming guidelines and code conventions
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=namingconventions&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
13 Sep 2006 1:23 PM
Robinson
<rob***@joshie.com.au> wrote in message
news:1158152327.210483.236950@i42g2000cwa.googlegroups.com...
>A while ago, I found a web page that describe an array of naming
> conventions when diming a variabe.
>
> For instance:
> tbl for table, str for string, i for integer.. (eg: tblMyTable,
> strMyString, iMyint, etc)
>
> I know there isn't a hard or fast rule of how your variable names
> should be formed, but my real question is does anyone have any links to
> web pages (M or other) that suggest types of naming conventions
> (prefixes) for different types variables??

imho this is less neccessary or useful nowdays with good intellisense and
tooltips in the development environment.  However I still prefix class
members with "m_" and global singletons with "g_", or shared variables with
"s_".  Overall it doesn't matter too much as long as you are consistent, at
least as far as maintenance is concerned.
Author
13 Sep 2006 3:21 PM
Mike Lowery
<rob***@joshie.com.au> wrote in message
news:1158152327.210483.236950@i42g2000cwa.googlegroups.com...
>A while ago, I found a web page that describe an array of naming
> conventions when diming a variabe.
>
> For instance:
> tbl for table, str for string, i for integer.. (eg: tblMyTable,
> strMyString, iMyint, etc)
>
> I know there isn't a hard or fast rule of how your variable names
> should be formed, but my real question is does anyone have any links to
> web pages (M or other) that suggest types of naming conventions
> (prefixes) for different types variables??

I've always found the suggestions here to be favorable:
http://www.xoc.net/standards/
Author
13 Sep 2006 7:23 PM
Fabio
<rob***@joshie.com.au> ha scritto nel messaggio
news:1158152327.210483.236950@i42g2000cwa.googlegroups.com...

>A while ago, I found a web page that describe an array of naming
> conventions when diming a variabe.
>
> For instance:
> tbl for table, str for string, i for integer.. (eg: tblMyTable,
> strMyString, iMyint, etc)
>
> I know there isn't a hard or fast rule of how your variable names
> should be formed, but my real question is does anyone have any links to
> web pages (M or other) that suggest types of naming conventions
> (prefixes) for different types variables??

The page is this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconnamingguidelines.asp

And as it says you should avoid the prefix and choose a good descriptive
name (i.e. "person" is good for a Person class, not for a string with the
person name in it, for this use personName).

The intellisense will do the rest.


--

Free .Net Reporting Tool - http://www.neodatatype.net