Thursday, May 15, 2008

C# coding Guidelines - An alternate naming scheme

I have always felt hard to agree with the naming schemes for variables under the "C# Coding standards", which on other grounds is a very find document.

According to Microsoft, they strictly oppose the use of Hungarian notations. Furthermore, they advise on using camelCase for naming all local, member and parameter variables. Microsoft advocate that it increases readability by supporting a consistent naming scheme throughout.

This is something I dont agree with. My argument is simple. How would one recognize between local, member and a parameter variable ?? i believe, it would have been helped readability furthur if we had naming scheme such that all 3 types of variables can be differentiated.

So what i recommend is
Local Variables : camelCase
Member Variable : "m_" or "g_" prefixed to the name
Parameter Variable : PascalCase

These are my personal views and i did find the readability much improved in this way.