Scott Wojan

DotRant BLOG
posts - 18, comments - 63, trackbacks - 5

My Links

News

Archives

Post Categories

Image Galleries

What Is Everyone's Biggest Pet Peeve??

(I know I'm setting myself up for at least one shot at me)
My #1 biggest pet peeve is C# naming conventions!!

Field Variables
Man does it drive me bonkers to find field variables with a prefix like _MyVariable or even worse m_MyVariable.  Arrrgh, it hurts just to even type it!  What does the underscore do for you?  Tell you that it's a field variable?  Why not have ÞMyVariable or or zæMyVariable?  Those are just as arbitrary as an underscore or m underscore.  If you can't determine the variable is a field variable from the code you're in, I'd say that your method or class has become too bloated and could use some refactoring.  Personally, I stick to field variables using camelCase and if it needs it, the property accessor with PascalCase.  So myVariable and MyVariable.  No other crazy characters needed!

Reference Types
If it isn't a value type, then it's a reference type and eventually down the inheritance tree its great grandpappy is Object.  Why oh why do I run across stuff like Customer objCustomer = new Customer();  I look at this and read "Object Customer is a Customer Object".  Come on people, this isn't an untyped scripting language!!

So, what gets your blood boiling out there in coding land?

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Thursday, June 29, 2006 6:16 PM | Filed Under [ Rants ]

Feedback

Gravatar

# re: What Is Everyone's Biggest Pet Peeve??

Using underscore is a best practice, which allows developers to easily identify field members in any editor at a glance - even Notepad. There are even rules which advise against naming field and properties the way you suggested (myVar and MyVar). The reason is because it's too easy to mistake one for the other - especially in other editors.

As for the Hungarian notation, that's an old standard that shouldn't really be used anymore. The only place I think it has a place in .NET is with VB, and that's only because of the case insensitivity, which limits names you can use.
6/29/2006 6:50 PM | Michael Flanakin
Gravatar

# re: What Is Everyone's Biggest Pet Peeve??

I'm really bummed that C# iuses a C...I mean, I really like the letter D. Why not D#? I mean seriously...why C? Just to make all the C coders out there happy? Just to try and get the C++ people on board? Or is C the first initial of the product group manager's daughter?

And why is the 'pound' sign used to represent 'sharp'? Why not call it C-Tilde (C~)...wait...k, that does look like a sperm kinda, so I understand why...what about D~...that would work ok.

Sigh...I just don't get these marketing decisions...

D
6/29/2006 6:54 PM | D'Arcy from Winnipeg
Gravatar

# re: What Is Everyone's Biggest Pet Peeve??

Michael Flanakin,

Where have you seen using an underscore listed as a "Best Practice"? If you look at the MSDN docs it's even specifically listed as DO NOT DO.

http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconfieldusageguidelines.asp

Under "Field Usage Guidelines":
"Do not apply a prefix to field names or static field names."
6/30/2006 4:43 AM | Scott Wojan
Gravatar

# re: What Is Everyone's Biggest Pet Peeve??

I use underscore + variablename.
Like _personnel.

This is because of the intellisense list in 2008 and former versions of Visual Studio. I do find the list much better in 2010 where it actually search for name in the variable/class.
Like if you type "nel" it will jump to _personnel (if you only have that variable).

I have nothing against people using or not using underscore before a variable.

I only use them for class and instance variables. Not in the scope of methods or as such.
6/8/2011 10:29 AM | DavidMB
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: