Coding Standards – Are Naming Convention Guidelines Worth Following?

ccoding-standards

I name my variables using the .Net conventions:

  • camelCase for variables and fields (I tend to use _camelCase for private fields in a class)
  • PascalCase for methods, properties and classes

The only place I deviate is on constants and Enums where I actually prefer the Java SCREAMING_CAPS style.

My company's codebase is littered with the pseudo-Hungarian notation style from VB6 and VBScript, if not full-blown Hungarian i.e.

  • s or str for Strings
  • i or int for Ints
  • d for decimal (or sometimes double)
  • o or obj for any kind of object

I cringe whenever I see that code style used in someone else's code (even in greenfield code, not just the legacy cruft), and I refuse to use that style myself. I've brought up standardizing on the .Net naming conventions in the past and it's just ignored – the people who write in Hungarian notation continue to do so, those of us who don't like me continue to use our own style; I'm a little afraid that if we do standardize (which I keep pushing for, but nobody else seems to care), it'll be on Hungarian notation and not the recommended way and then I'll be forced to write code like that.

Am I making a mountain out of a molehill in regards to this? Should I not care if the code is littered with redundant identifiers and not descriptive names, and continue to use my own way and push for that to become the standard?

Best Answer

The only thing you should care about is that you're working in a team where people don't care about cleaning up things a bit. That is very sad.

Do what you do, continue to use the modern style and invite people (but not force them) to adopt it as well. It will take time of course. After some time you will see whether it's going anywhere and what you might be doing next.

P.S. How about arranging a meeting on this issue and invite everyone involved. Then you will get their full attention, denote the problem and present your approach. It will give them something to think about. Perhaps from your local attempts they're not taking you very seriously.