Bad naming convention bothers me

  • Thread starter Thread starter csharper
  • Start date Start date
C

csharper

Ever since I started to learn programming, I have been used to modern
object-oriented programming language (such as C# and Java) naming
conventions. For C#, I try my best to follow the naming guidelines
MSDN laid out. But more often than not when I take on a project, I
see all kinds of ugly naming mixtures. For example, these are just
some of what I have seen in the code of a project I am working on

clsEmployee // Can you say "Employee"? Why cls?
m_strFN // Can you say "FirstName"?
strID // What ID? Can you say something like "EmployeeID" or
"employeeID"?
m_strID // Same as above.
eMode, // What mode? Can you say maybe "PlayMode" or "PoopingMode"?
blnError // Can you just say something like "IsWrong" or "isWrong"?
XmlNode objNode // How about "XmlNode studentNode"?
oItem // Will it kill you to say "item" instead?
objReturn // Just because it is an object you will return from your
method?
strReturn // Just because it is a string you will return from your
method?
objPres // Is it president or presentation or presenter?
objAns // Looks like it is answer?
m_blnIsCorrect // "IsCorrect" can't make any sense to you?

Will these names bother you? The mixture of Hungarian notation,
underscores, plus arbitrary abbreviation really bothers me. Worse yet,
when I code something new in the project, I guess will have to follow
this bad practice in order to make it look consistent (in a bad way).
 
Ever since I started to learn programming, I have been used to modern
object-oriented programming language (such as C# and Java) naming
conventions. For C#, I try my best to follow the naming guidelines
MSDN laid out. But more often than not when I take on a project, I
see all kinds of ugly naming mixtures. For example, these are just
some of what I have seen in the code of a project I am working on

clsEmployee // Can you say "Employee"? Why cls?
m_strFN // Can you say "FirstName"?
strID // What ID? Can you say something like "EmployeeID" or
"employeeID"?
m_strID // Same as above.
eMode, // What mode? Can you say maybe "PlayMode" or "PoopingMode"?
blnError // Can you just say something like "IsWrong" or "isWrong"?
XmlNode objNode // How about "XmlNode studentNode"?
oItem // Will it kill you to say "item" instead?
objReturn // Just because it is an object you will return from your
method?
strReturn // Just because it is a string you will return from your
method?
objPres // Is it president or presentation or presenter?
objAns // Looks like it is answer?
m_blnIsCorrect // "IsCorrect" can't make any sense to you?

Will these names bother you? The mixture of Hungarian notation,
underscores, plus arbitrary abbreviation really bothers me. Worse yet,
when I code something new in the project, I guess will have to follow
this bad practice in order to make it look consistent (in a bad way).

The names above do leave something to be desired, for sure. What's not
clear is what you expect anyone here to do about it :) If you don't like
the way people on your project name variables (and no-one can blame you
for that) then you need to talk to them -- people here can agree with
you, but they can't help you.

Incidentally, I've never personally had a problem with people using m_
for member variables, and I personally prefer naming schemes which
distinguish between function names:

silly_func(<whatever)

And variable names:

theBigFunVariable

I certainly don't think that the usual naming conventions for C# and
Java are "The One True Way" (I don't think there is one). But you have
to live with the prevailing naming culture in your environment, or
you'll go crazy. One cannot fight pointless religious wars forever
(you'd have thought, anyway). That doesn't mean that people shouldn't be
encouraged to give things nice, simple names, and eschew yucky Hungarian
notation :)

Regards,
Stu
 
csharper said:
Will these names bother you? The mixture of Hungarian notation,
underscores, plus arbitrary abbreviation really bothers me. Worse
yet,
when I code something new in the project, I guess will have to
follow
this bad practice in order to make it look consistent (in a bad
way).

Do you work in an IT Department? if so, something to bring up at a
staff meeting in a conductive manner.
 
Do you work in an IT Department? if so, something to bring up at a staff
meeting in a conductive manner.

Or even a "constructive" manner, unless you're looking to electrocute them,
in which case stick with conductive....

(Hey, Nobody, welcome to the C# group! Assuming you're THAT Nobody, that
is.... Hmmm, maybe not; your email address is different from the Nobody I
know.)
 
Do you work in an IT Department? if so, something to bring up at a
staff meeting in a conductive manner.

Thanks for sharing your ideas. I know this can get religious, but I
really think a professional IT company should try its best to have
consistent, more widely recommended naming convention, rather than
have a code base with mixed naming styles.

Anyway, I did talked to the boss and said that I have no problem
following the mixed naming convention that exists in the current code,
but I do prefer to use the recommended naming convention by Microsoft.
 
The names above do leave something to be desired, for sure. What's not
clear is what you expect anyone here to do about it :) If you don't like
the way people on your project name variables (and no-one can blame you
for that) then you need to talk to them -- people here can agree with
you, but they can't help you.

Incidentally, I've never personally had a problem with people using m_
for member variables, and I personally prefer naming schemes which
distinguish between function names:

silly_func(<whatever)

And variable names:

theBigFunVariable

I certainly don't think that the usual naming conventions for C# and
Java are "The One True Way" (I don't think there is one). But you have
to live with the prevailing naming culture in your environment, or
you'll go crazy. One cannot fight pointless religious wars forever
(you'd have thought, anyway). That doesn't mean that people shouldn't be
encouraged to give things nice, simple names, and eschew yucky Hungarian
notation :)

Regards,
Stu

I was just trying to see what naming conventions you guys follow, plus
a little ventilation of my frustration. :-)
 
I was just trying to see what naming conventions you guys follow, plus
a little ventilation of my frustration. :-)

My preferred naming convention emphasizes readability and does not
change whether the reading is done silently or aloud. Explicit naming
conventions lose value as soon as there is a need to translate "em
under table cust" or some similar nonsense. Just call it the
customerTable everywhere.

regards
A.G.
 
Back
Top