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 2301
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******** ******@TK2MSFTN GP10.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/cpconstaticfiel dnamingguidelin
es.htm http://msdn.microsoft.com/library/de.../en-us/cpgenre
f/html/cpconstaticfiel dnamingguidelin es.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 variables.
Working with WinForms, I believe it would be helpful to
have some type of prefix. In Visual Basic we used
m_variableName. But I can't find any suggestions on this.
Any help on this would be great. Thanks,
|
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
variables?
My coding preference is to use this everywhere (banish Hungarian and
follow the capitalization rules) but I need to sell it to team
members.
|
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
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.
|
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...
|
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
...
| |
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 wonder if I can use the same naming conventions as for VB6 ? If so, what
about the names for the new objects in .NET.
Kind regards
rastaman
|
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...
|
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.
--
|
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 in camelCase versus camel_case or anything
mentioned in 'PEP 8 -- Style Guide for Python Code'. What I'm looking
for is hints or ideas how to name your variables and especially how to
name functions, methods and classes.
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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();...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |