473,651 Members | 2,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Naming convention of Variables

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

Sep 13 '06 #1
4 1767
<ro****@joshie. com.auwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.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.


Sep 13 '06 #2
<ro****@joshie. com.auschrieb:
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=namingconve ntions&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Sep 13 '06 #3

<ro****@joshie. com.auwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.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/
Sep 13 '06 #4
<ro****@joshie. com.auha scritto nel messaggio
news:11******** **************@ i42g2000cwa.goo glegroups.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/de...guidelines.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
Sep 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2328
by: Sandeep Sharma | last post by:
For many years I have been following the convention of naming all class attributes with a leading underscore. This enables me to quickly identify the class attributes when I encounter them in the source code. Even the GoF book follows this convention, although it's true that the GoF book is not an authoritative source for coding guidelines. Recently a colleague remarked that using a leading underscore is a bad programming practice...
27
6696
by: Derek | last post by:
The company where I work uses a naming convention that I have never used before. They use mixed-case letters for public member functions, but lower-case with underscores for the rest, like this: class Foo { public: void somePublicMemberFunction(); protected:
7
1517
by: DEX | last post by:
Main page of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.main.html Rules of my NC: http://www.ddmrm.com/coding/cpp/naming/cpp.naming.rules.html Comments are welcome. ...
7
2466
by: cmiddlebrook | last post by:
Hi there, I keep finding myself getting inconsistent with naming conventions for things like member variables, class names etc and I just want to find something that suits me and stick to it. I am wondering if there are any naming conventions around that are deemed suitable by the general C++ community. I have googled around and I can't find much - mostly long lists of hungarian-like prefixes which is not really what I'm after.
4
7143
by: Mark Broadbent | last post by:
stupid question time again to most of you experts but this is something that continually bothers me. I am trying to get into the habit of naming variables and controls in an assembly as per convensions. The thing is that Ive never really get the full reference to check against. Ive seen a couple of articles, but there always seems to be a bit missing. I also always seem to run into conflicting convensions both in code samples themselves...
48
1780
by: Robert Jacobson | last post by:
Hello all, If I have a class called "Foo," is there a preferred naming convention for iterating through each Foo instance in a collection of Foos? I've seen several different variations, even in the MSDN documentation: #1: For each Foo as Foo in Foos ...
0
1738
by: Carl Colijn | last post by:
Hi all, Disclaimer: before I might trigger your "let's start a holy war!" button, I'd like to say I'm not intended to; I just post this message to get some input and not to promote "Yet Another Naming Convention". It's a bit of a long post, but I've spent the past few days on perfecting this, finally came to the conclusion that maybe I went a bit overboard with it, almost willing to just say "the @#$ with it" but I didn't want to let it...
8
2665
by: bim_bom | last post by:
Hi, is there any tool to change naming convention in c++ sources? I mean something, that parses cpp and h files in my project, and it finds, what variables are there declared. I think, it should have a public "CALLBACK" function (which would be impemented by me), which would tell the program, how to rename variables and functions. It should work like that: I have sourcecode:
114
7821
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for any comments. --
35
12175
by: Smithers | last post by:
Is it common practise to begin the name of form classes with "frm" (e.g., frmOneForm, frmAnotherForm). Or is that generally considered an outdated convention? If not "frm" what is a common or recommended practise? Thanks.
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8695
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.