MS recommends keeping Hungarian notation off parameters for
public/protected methods. Is the best practice to do so for private as
well? It seems that consistency would indicate all should be
non-Hungarian, but I'm not sure how well-adopted the "no Hungarian on
parameters" is.
And for variable naming, is Hungarian still regularly used, or has
that been abandoned as well?
Thanks. 6 2247
Cristof Falk wrote: MS recommends keeping Hungarian notation off parameters for public/protected methods. Is the best practice to do so for private as well?
Personally, I don't think that /good/ C# code benefits from Hungarian
notation at all. If you write more, shorter methods and more, shorter
classes, the code doesn't need any kind of type prefixes. I'd go so far
as to say that *any* prefixes decrease readability.
Variables should be named so that one could read them aloud and
instantly understand their purpose.
As for using Hungarian notation only for private data, that'd give a
additional disadvantage that your code is inconsistent.
It seems that consistency would indicate all should be non-Hungarian, but I'm not sure how well-adopted the "no Hungarian on parameters" is.
And for variable naming, is Hungarian still regularly used, or has that been abandoned as well?
Thanks. That's what I thought was the intentions of consistent naming,
but wanted a sanity check before I go telling team members that
they're so very far from the standards! -cf
On Sat, 10 Apr 2004 13:15:55 +0100, C# Learner <cs****@learner.here>
wrote: Cristof Falk wrote:
MS recommends keeping Hungarian notation off parameters for public/protected methods. Is the best practice to do so for private as well?
Personally, I don't think that /good/ C# code benefits from Hungarian notation at all. If you write more, shorter methods and more, shorter classes, the code doesn't need any kind of type prefixes. I'd go so far as to say that *any* prefixes decrease readability.
Variables should be named so that one could read them aloud and instantly understand their purpose.
As for using Hungarian notation only for private data, that'd give a additional disadvantage that your code is inconsistent.
It seems that consistency would indicate all should be non-Hungarian, but I'm not sure how well-adopted the "no Hungarian on parameters" is.
And for variable naming, is Hungarian still regularly used, or has that been abandoned as well?
Hi Cristo,
MS recommends Hungarian notation only for static fields.
IMHO, it's best to use non-hungarian for all exposed fields, properties,
methods etc. because this adds clarity for developers who use our types.
(For eg. think about Intellisense displaying hungarian based entities -
that's something which won't be very attractive).
Within the type definition though, you might use any notation you want.
HTH,
fbhcah
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
fbhcah wrote: Hi Cristo,
MS recommends Hungarian notation only for static fields.
Huh? It reads, "Do not use a Hungarian notation prefix on static field
names." at: http://msdn.microsoft.com/library/de...tionstyles.asp
-or- http://tinyurl.com/26m8b
IMHO, it's best to use non-hungarian for all exposed fields, properties, methods etc. because this adds clarity for developers who use our types. (For eg. think about Intellisense displaying hungarian based entities - that's something which won't be very attractive).
Within the type definition though, you might use any notation you want.
That causes the problem of inconsistency, though.
You are correct. There is NO hungarian notation recommendations in any of
the naming standards for .NET from Microsoft.
--
-----
Sam Gentile
Microsoft MVP - C#/.NET
..NET Blog http://samgentile.com/blog/
Please do NOT contact me directly but respond to
the newsgroup instead.
---------
"C# Learner" <cs****@learner.here> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl... fbhcah wrote:
Hi Cristo,
MS recommends Hungarian notation only for static fields.
Huh? It reads, "Do not use a Hungarian notation prefix on static field names." at:
http://msdn.microsoft.com/library/de...tionstyles.asp -or- http://tinyurl.com/26m8b
IMHO, it's best to use non-hungarian for all exposed fields, properties, methods etc. because this adds clarity for developers who use our types. (For eg. think about Intellisense displaying hungarian based entities - that's something which won't be very attractive). Within the type definition though, you might use any notation you want.
That causes the problem of inconsistency, though.
Hey - the problem was this! I found out an inconsistancy in MSDN online
and the MSDN CD.
Check these links which are the same topics but one which states to use
Hungarian notation (CD), and the other which states not to (online).
ms-help://MS.VSCC/MS.MSDNVS/cpgenref/html/cpconstaticfieldnamingguidelin
es.htm http://msdn.microsoft.com/library/de.../en-us/cpgenre
f/html/cpconstaticfieldnamingguidelines.asp
HTH,
fbhcah
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ted |
last post by:
I'm trying to come up with naming conventions for my
company as we move to C#. I'm looking through the Naming
Guidelines section on MSDN, but I'm unable to find a
recommendation for class scope...
|
by: Cristof Falk |
last post by:
I wanted to get a feel. The documentation gives naming conventions for
public/protected members. Is this truly widely adopted?
And what about using the same conventions for private members and...
|
by: Cristof Falk |
last post by:
MS recommends keeping Hungarian notation off parameters for
public/protected methods. Is the best practice to do so for private as
well? It seems that consistency would indicate all should be...
|
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...
|
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...
|
by: rastaman |
last post by:
Hi all,
I know of the existence of Object Naming Conventions for Visual Basic 6.
Now I'm reading some books about VB .NET, but the names used for the
objects are button1, picturebox1, etc.
I...
|
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...
|
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...
|
by: Thorsten Kampe |
last post by:
Okay,
I hear you saying 'not another naming conventions thread'. I've read
through Google and the 'naming conventions' threads were rather
*spelling conventions* threads.
I'm not interested...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |