473,795 Members | 3,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hungarian notation and variable names

For most of my variable names, I use Hungarian notation to determine between
one and the other. But what names can I use for public and private
variables? I was using prv_varName and pub_varName but that sounded really
strange. I've seen variable names that begin with _varName. Is that another
possibility?

Den
Nov 16 '05
14 2140
if your saying the bar vs Bar is easier to read then Bar vs _Bar.
heh, thats pretty out there.

On Mon, 24 May 2004 20:48:23 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co m> wrote:
Anders Borum <a@b.dk> wrote:
> The standard .NET naming conventions enable you to distinguish between a
> local variable and a property:
>
> void Foo()
> {
> int bar = 5; // local variable
> Bar = 5; // property
> }


Although this leads to poor readable code.


I think that's debatable. I certainly find it easier to read that than
_bar or m_bar - I can notice the case easily enough to distinguish
between the bar and Bar, but _bar and m_bar give me a mental hiccough
when reading.
Another thing which is more
important is the casing. I favour Pascal casing for public members, but like
camel casing for private members.

If I recall correctly, this is also what Microsoft recommends.


Indeed.


Nov 16 '05 #11
Allen Anderson <al***@sparkysy stems.com> wrote:
if your saying the bar vs Bar is easier to read then Bar vs _Bar.
heh, thats pretty out there.


Not really - there are plenty of people who use each of the
conventions. We just have different opinions, that's all.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #12
Allen Anderson wrote:
if your saying the bar vs Bar is easier to read then Bar vs _Bar.
heh, thats pretty out there.


I don't agree -- the former is easier on my eye.
Nov 16 '05 #13
fair enough

On Mon, 24 May 2004 21:39:52 +0100, Jon Skeet [C# MVP]
<sk***@pobox.co m> wrote:
Allen Anderson <al***@sparkysy stems.com> wrote:
if your saying the bar vs Bar is easier to read then Bar vs _Bar.
heh, thats pretty out there.


Not really - there are plenty of people who use each of the
conventions. We just have different opinions, that's all.


Nov 16 '05 #14
There's no real standard at my company. Since this application is being
written from scratch, I can use any type of notation. I usually use HN for
variables but I want to be able to distinguish between a local variable and
a public property.
"Allen Anderson" <al***@sparkysy stems.com> wrote in message
news:fk******** *************** *********@4ax.c om...
this is a topic of some debate in the .net community. Many companies
require hungarian for local and member variables but don't use them
for properties.

Some people take whether to use hungarian notation or not as an
article of religous faith and may become abusive if you don't do
exactly what they recommend. Ignore them and use whatever your
particular company has standardized on. Remember however, MS
recommends against using HN for .net.

On Mon, 24 May 2004 10:51:58 -0400, "Denny" <de***@crane.co m> wrote:
For most of my variable names, I use Hungarian notation to determine betweenone and the other. But what names can I use for public and private
variables? I was using prv_varName and pub_varName but that sounded reallystrange. I've seen variable names that begin with _varName. Is that anotherpossibility?

Den

Nov 16 '05 #15

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

Similar topics

28
10430
by: Phill | last post by:
Does anyone know the reasoning for Microsoft abandoning Hungarina Notation in C#? I have found it very usefull in C++. I like this style: constant: MY_CONSTANT methos: myMethod() class: MyClass variable: iMyInteger
66
3713
by: CMM | last post by:
So after three years of working in .NET and stubbornly holding on to my old hungarian notation practices--- I resolved to try to rid myself of the habit. Man, I gotta say that it is liberating!!! I love it. At first I struggled with how to name controls. I tried to keep some sort of notation with them... but I threw that away too!!! I now name them as if they were simply properties of the form (FirstNameLabel, etc.)... which they ARE!......
24
3839
by: Ronald S. Cook | last post by:
An ongoing philosophical argument, I would like your opinions. With the release of .NET, Microsoft spoke of moving away from the notation as a best practice. I'm a believer for a few reasons: 1) Consistency throughout and knowing which objects are yours (clsEmployee, tblEmployee, frmEmployee, etc). 2) Not having to name an employee form EmployeeForm.aspx because the mane is already taken by your class named Employee.cs
6
4070
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
3
10562
by: Grey Squirrel | last post by:
On wednesday my company will have an open ended discussion whether to standardize hungarian notation or pascal/cammel case notation. We'd love to recieve some feedback on what other people are using out there and why. Thanks!
14
1552
by: Ronald S. Cook | last post by:
I've been weaning myself off of Hungarian notation because that's what Microsoft is telling me to do, and I want to be a good little MS developer. But things keep coming up that make me miss my little 3-character prefixes. I'm fine with EmployeeFirstNameLabel instead of lblEmployeeFirstName, but at the table and class level, I get frustrated because terms I want to use reserved keywords. I wanted "Event" and "User" as classes and table...
18
4251
by: dom.k.black | last post by:
I am looking at starting a new piece of work for a company who are heavily into hungarian notation for C coding. Any killer arguments for NOT carrying this terrible practice forward into new C++ code?
12
3599
by: inhahe | last post by:
Does anybody know of a list for canonical prefixes to use for hungarian notation in Python? Not that I plan to name all my variables with hungarian notation, but just for when it's appropriate.
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
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
7538
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
6779
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
5436
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
4113
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
3
2920
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.