Coding Standards

U

UJ

Folks,
Can anybody point me towards a site that explains the Microsoft Coding
Standards? I downloaded FXCop and understandably it's complaining a lot.

I do have questions though:

1. What if any prefixes should be used to define scope of variables.
2. How are people naming properties? I currently use a prefix of prp so
they are all grouped together and easy to find. FXCop doesn't like that.

Any thoughts or suggestions would be appreciated.

TIA - Jeff.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

UJ said:
Folks,
Can anybody point me towards a site that explains the Microsoft Coding
Standards? I downloaded FXCop and understandably it's complaining a lot.

I do have questions though:

1. What if any prefixes should be used to define scope of variables.
2. How are people naming properties? I currently use a prefix of prp so
they are all grouped together and easy to find. FXCop doesn't like that.

Don't FxCop gives you a link to where you can see a detailed explanation
of why it flagged it?

Anyway, see
http://msdn.microsoft.com/library/d...en-us/cpgenref/html/cpconnamingguidelines.asp
for further details


cheers,
 
N

Nick Hounsome

UJ said:
Folks,
Can anybody point me towards a site that explains the Microsoft Coding
Standards? I downloaded FXCop and understandably it's complaining a lot.

I do have questions though:

1. What if any prefixes should be used to define scope of variables.
2. How are people naming properties? I currently use a prefix of prp so
they are all grouped together and easy to find. FXCop doesn't like that.

Thank goodness.

Do you really think that it is helpful to use a totally different convetion
to all the microsoft stuff and everything ever written in any book I have
ever read?

Just as an example: If I want the address of a person then I expect to find
it named "Address" - It will probably be a property but if it's a method
then that's cool too.

So I type 'A' and there it will be in intellisense near the top of the list.
How is this better than typing "prpA"?

Even if somehow it does help you when you are developing your code this is
irrelevant as the main aim with methods and properties is to name them in a
way that is helpful to users of the class.
 
G

Guest

Using convention strongly is usefull in the bounds of company, to give u
solid code understanding and improve readability.

Conventions in artives and magazines are simplified, because author want to
show you the gist of the code.
In your case, Address means a property, coz it's common for the properties
to start with capital letter.
We more read then type, and for this reason the usability of typing doesn't
make sence - there are several VSIDE addings, that improve intelliscence and
could show you either properties or methods first.
The idea to make code readable.

Hungarian notation lost its sence due to metadates in .net - we move mouse
over the method/property and we got description.
Do you really think that it is helpful to use a totally different convetion
to all the microsoft stuff and everything ever written in any book I have
ever read?

Just as an example: If I want the address of a person then I expect to find
it named "Address" - It will probably be a property but if it's a method
then that's cool too.

So I type 'A' and there it will be in intellisense near the top of the list.
How is this better than typing "prpA"?

Even if somehow it does help you when you are developing your code this is
irrelevant as the main aim with methods and properties is to name them in a
way that is helpful to users of the class.

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
D

dotnetchic

Jeff,
Below is a site with a link to a standards document that I've adopted.
It hasn't been updated in a while, but it was pretty complete to begin
with.

http://weblogs.asp.net/lhunt/archive/2004/08/17/csharpcodingstandardsv113.aspx

The only hungarian notation that I still use is with windows form
control names (i.e., btnApply, etc) to help in finding them quickly.
Private field names prefixed with underscore comes in handy.

BTW, I think it's great that there are others out there at least trying
to adhere to a standard.

-SLC
 
U

UJ

Thanks for the info.

Can you suggest any of the VS IDE Add-ons that will improve intellisense?

TIA - Jeff
 
H

halvard.hagesaether

Try FxCop. It's not for improving intellisense, but Microsofts own tool
for checking code. It will flag anything that break their naming
conventions. They also give well explained reasons for their naming
convention rules.

And, even though it is Microsoft, it is free ...

Halvard.


UJ skrev:
 
H

halvard.hagesaether

Obviously I didn't read all the posts in this thread before I answered,
otherwise I wouldn't have suggested FxCop.
Shame on me :)

Just ignore ...

Halvard.
 
G

Guest

See list of tools there http://www.refactoring.com/tools.html

ReSharper not good choose with big solutions, it's go down with even 10
projects in solution.
Im using Refactor Pro!

Moreover, look at code-analyzing tools, such as FixCop or .NET Test from
ParaSoft. They perform static analyzis of your code to check how it conforms
your corporate code standards. You can tune these tools for your own
codestandards

UJ said:
Thanks for the info.
Can you suggest any of the VS IDE Add-ons that will improve intellisense?
TIA - Jeff

--
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top