Responding to this link in an old thread: http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconnetframeworkdesignguidelines.asp
According to that naming convention, a parameter should be be named like
this "typeName" (ei stringFirstName). The types that they list add to the
variable name and the amount of typing to do by quite a lot when compounded
by the amount of code that goesinto creating an app. Is there anyone still
using the hungarian convention or a variation of it?
Even though the hungarian convention is supposedly no longer considered good
in the Naming Conventions for Microsoft, I'm considering using it just to
cut down and the amount of typing. Any programmer is going to know what it
means and it will cut down on the amount of code.
Maybe there's a good reason for typing out the whole data type word,
anyone??
I would also prefer to perfix private members with something. VB used "m_"
and it looks like c++ did as well, although it may be a little messy... I
think I like just the underscore only, "_".
Also, I believer the basic reason that the hungarian notation is out is due
to the fact that VS.NET is strongly typed. But that only helps you IF you
are using VS.NET. If you're using some other program, say like Notepad, you
wouldn't have the benefit of iintellisense and I would think that the
hungarian notation would still be valuable.
Any other thoughts?
I have the task of setting up our company naming and coding conventions and
I would like extra input before I settle on one specific set of guidlines.
Thanks in advance,
Andrea Williams 6 1484
I like an abbreviated Hungarian notation for .NET controls; it makes using
the code completion much easier. I used to have C++ that explicitly
referenced "this," but now I do it all the time in C#, for similar reasons.
My company's standard prefix for member variables is "m_"; I *don't* like
that because it requires me to type an extra two characters, incl. that
inconvenient '_', to get code completion. However,
using '_' as a prefix is short-sighted; it's NOT CLS-compliant, and in the
world of C/C++, it's often considered bad style (because of collisions with
legacy globals).
On the other hand, strings are so ubiquitous that prefixing every string
variable with "string" seems silly, to say nothing of "num", "countOf", etc.
Andrea Williams wrote: Responding to this link in an old thread: http://msdn.microsoft.com/library/de...us/cpgenref/ht ml/cpconnetframeworkdesignguidelines.asp
According to that naming convention, a parameter should be be named like this "typeName" (ei stringFirstName). The types that they list add to the variable name and the amount of typing to do by quite a lot when compounded by the amount of code that goesinto creating an app. Is there anyone still using the hungarian convention or a variation of it?
I think you're getting a bit confused on what they're advocating - they
don't suggest prefixing parameter names with the type of the parameter.
Note that in the example they give, the typeName parameter is a string
type, but they didn't call it stringName.
The guidelines explicitly say:
================================================
Use names that describe a parameter's meaning rather than names that
describe a parameter's type. Development tools should provide meaningful
information about a parameter's type. Therefore, a parameter's name can
be put to better use by describing meaning. Use type-based parameter
names sparingly and only where it is appropriate.
================================================ Even though the hungarian convention is supposedly no longer considered good in the Naming Conventions for Microsoft, I'm considering using it just to cut down and the amount of typing. Any programmer is going to know what it means and it will cut down on the amount of code.
Maybe there's a good reason for typing out the whole data type word, anyone??
I would also prefer to perfix private members with something. VB used "m_" and it looks like c++ did as well, although it may be a little messy... I think I like just the underscore only, "_".
Also, I believer the basic reason that the hungarian notation is out is due to the fact that VS.NET is strongly typed. But that only helps you IF you are using VS.NET. If you're using some other program, say like Notepad, you wouldn't have the benefit of iintellisense and I would think that the hungarian notation would still be valuable.
Any other thoughts?
I have the task of setting up our company naming and coding conventions and I would like extra input before I settle on one specific set of guidlines.
Thanks in advance,
Andrea Williams
--
mikeb
So if the TYPE in typeName doesn't indicate the data type, what does it
indicate. The example showed the following:
[Visual Basic]
Sub Write(doubleValue As Double);
Sub Write(singleValue As Single);
Sub Write(longValue As Long);
Sub Write(integerValue As Integer);
Sub Write(shortValue As Short);
[C#]
void Write(double doubleValue);
void Write(float floatValue);
void Write(long longValue);
void Write(int intValue);
void Write(short shortValue);
My resource: http://msdn.microsoft.com/library/de...econfusion.asp
What am I misinterpreting here??
Andrea I think you're getting a bit confused on what they're advocating - they don't suggest prefixing parameter names with the type of the parameter. Note that in the example they give, the typeName parameter is a string type, but they didn't call it stringName.
The guidelines explicitly say:
================================================ Use names that describe a parameter's meaning rather than names that describe a parameter's type. Development tools should provide meaningful information about a parameter's type. Therefore, a parameter's name can be put to better use by describing meaning. Use type-based parameter names sparingly and only where it is appropriate. ================================================
-- mikeb
So I'm curious, do they have you use three character prefixes or one
character on most and three when needed?
Example:
string strName;
string sName;
So I should be safe if I just add the 'm' for private members, right? No
legacy issues with that I hope?
Andrea
"Tony Nassar" <tn*****@theanalysiscorp.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl... I like an abbreviated Hungarian notation for .NET controls; it makes using the code completion much easier. I used to have C++ that explicitly referenced "this," but now I do it all the time in C#, for similar
reasons. My company's standard prefix for member variables is "m_"; I *don't* like that because it requires me to type an extra two characters, incl. that inconvenient '_', to get code completion. However, using '_' as a prefix is short-sighted; it's NOT CLS-compliant, and in the world of C/C++, it's often considered bad style (because of collisions
with legacy globals).
On the other hand, strings are so ubiquitous that prefixing every string variable with "string" seems silly, to say nothing of "num", "countOf",
etc.
Andrea Williams wrote: So if the TYPE in typeName doesn't indicate the data type, what does it indicate. The example showed the following:
[Visual Basic] Sub Write(doubleValue As Double); Sub Write(singleValue As Single); Sub Write(longValue As Long); Sub Write(integerValue As Integer); Sub Write(shortValue As Short); [C#] void Write(double doubleValue); void Write(float floatValue); void Write(long longValue); void Write(int intValue); void Write(short shortValue);
My resource: http://msdn.microsoft.com/library/de...econfusion.asp
What am I misinterpreting here??
I was actually looking at a different part of the naming guidelines (the
"Parameter Naming Guidelines" page).
However, if you look closely at the "Avoiding Type Name Confusion" page
page you pointed out, the section you're citing is their example of what
*not* to do.
Right before the box with the example, there's a line that says;
------------------------------------------
Do not create language-specific method names, as in the following example.
------------------------------------------
Later they say that *if* you must include the data type in the parameter
name, you should use the 'universal' type names instead of the language
specific variants, since they differ by language sometimes (ie., float
in C# is Single in VB.NET)
In the "typeName" parameter example, they name the parameter that way
because the parameter to the GetType() method specifies the name of the
type desired. Note again, that the actual type of the "typeName"
parameter is System.String. Andrea
I think you're getting a bit confused on what they're advocating - they don't suggest prefixing parameter names with the type of the parameter. Note that in the example they give, the typeName parameter is a string type, but they didn't call it stringName.
The guidelines explicitly say:
============================================== == Use names that describe a parameter's meaning rather than names that describe a parameter's type. Development tools should provide meaningful information about a parameter's type. Therefore, a parameter's name can be put to better use by describing meaning. Use type-based parameter names sparingly and only where it is appropriate. ============================================== ==
-- mikeb
--
mikeb
Can I suggest that you look at the following link. It is a combined
coding standard which we wrote based on the Microsoft .NET Guideline
and a C++ standard that Philips Medical Systems has been using for
years. http://www.tiobe.com/standards/gemrcsharpcs.pdf
Dennis Doomen
Sioux TSO B.V.
mikeb <ma************@mailnull.com> wrote in message news:<ud**************@TK2MSFTNGP11.phx.gbl>... Andrea Williams wrote:
So if the TYPE in typeName doesn't indicate the data type, what does it indicate. The example showed the following:
[Visual Basic] Sub Write(doubleValue As Double); Sub Write(singleValue As Single); Sub Write(longValue As Long); Sub Write(integerValue As Integer); Sub Write(shortValue As Short); [C#] void Write(double doubleValue); void Write(float floatValue); void Write(long longValue); void Write(int intValue); void Write(short shortValue);
My resource: http://msdn.microsoft.com/library/de...econfusion.asp
What am I misinterpreting here??
I was actually looking at a different part of the naming guidelines (the "Parameter Naming Guidelines" page).
However, if you look closely at the "Avoiding Type Name Confusion" page page you pointed out, the section you're citing is their example of what *not* to do.
Right before the box with the example, there's a line that says;
------------------------------------------ Do not create language-specific method names, as in the following example. ------------------------------------------
Later they say that *if* you must include the data type in the parameter name, you should use the 'universal' type names instead of the language specific variants, since they differ by language sometimes (ie., float in C# is Single in VB.NET)
In the "typeName" parameter example, they name the parameter that way because the parameter to the GetType() method specifies the name of the type desired. Note again, that the actual type of the "typeName" parameter is System.String.
Andrea
I think you're getting a bit confused on what they're advocating - they don't suggest prefixing parameter names with the type of the parameter. Note that in the example they give, the typeName parameter is a string type, but they didn't call it stringName.
The guidelines explicitly say:
============================================== == Use names that describe a parameter's meaning rather than names that describe a parameter's type. Development tools should provide meaningful information about a parameter's type. Therefore, a parameter's name can be put to better use by describing meaning. Use type-based parameter names sparingly and only where it is appropriate. ============================================== ==
-- mikeb
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Roman Roelofsen |
last post by:
Dear python-list,
while looking for some coding conventions for python programs, i found the
PEP8 at http://www.python.org/peps/pep-0008.html. It defines the rules very
well and leaves no space...
|
by: David Inada |
last post by:
w3c talks about scripting and gives examples. But I could not find a
coding standard for ASP/VBScript.
I am trying to find any standards and tools to apply those standards to
my companies...
|
by: jarit |
last post by:
Hi,
Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.
Well written and free to download.
www.demachina.com/products/swat
Jeroen
|
by: Neil Zanella |
last post by:
Hello,
Some programmers like to use a coding convention where all names of
variables that are pointers start with the letter p (and sometimes
even use similar conventions for strings and other...
|
by: Natt Serrasalmus |
last post by:
After years of operating without any coding standards whatsoever, the
company that I recently started working for has decided that it might be a
good idea to have some. I'm involved in this...
|
by: Ralph Lund |
last post by:
Hi.
I am starting a new project with C#. I am searching for "good" coding
conventions. I know that there are some coding conventions from microsoft,
(but they are very extensive and not clear)....
|
by: Dotnetjunky |
last post by:
Hi,
So far, I've found tons of documents describing
recommended coding standards for C#, but not a single
piece on VB.NET yet.
Anybody here knows such a coding standards guideline on
VB.NET...
|
by: Josh Golden |
last post by:
i lead a small development team (based on some of my posts that might cause
some people to choke themselves, but have no fear, i am NOT the lead
developer, the people on my team are great - i'm...
|
by: auratius |
last post by:
http://www.auratius.co.za/CSharpCodingStandards.html
Complete CSharp Coding Standards
1. Naming Conventions and Styles
2. Coding Practices
3. Project Settings and Project Structure
4....
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
|
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...
|
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...
|
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,...
|
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...
| |