Naming Convention

S

sck10

Hello,

Numerous people have kindly commented on my use of the Hungarian style
naming convention, which I am appreciative of. In trying to move away from
this naming style, I have run into some difficulty. For example, I have a
application that has something like the following:

Text Box: txtLastName
Label: lblLastName
HiddenValue: hdnLastName

In terms of best practice, how should I name these three objects? Any help
with this would be appreciated.

Thanks, sck10
 
E

Eliyahu Goldin

Looks fine to me, I am also using the same "camel" style if the declaration
are private. Public and protected names usually start with a capital.
 
T

tdavisjr

Well, this all started when MSFT released a document stating that Hungarian
style programming is discouraged. I don't see why for so many years this was
quite fine; but now all of the sudden with .NET it is discouraged. You can
use variation of styles. They recommend stuff like:

lastNameTextBox
LastName
lastName

but to tell you the truth, this is all hogwash. If you find a style that
your are comfortable with, stick with it. Or, if you company has a set
standard use it. Otherwise, ignore what others are saying. Is is
non-productive.
 
M

Mark Rae

Well, this all started when MSFT released a document stating that
Hungarian style programming is discouraged. I don't see why for so many
years this was quite fine; but now all of the sudden with .NET it is
discouraged. You can use variation of styles. They recommend stuff like:

lastNameTextBox
LastName
lastName

but to tell you the truth, this is all hogwash. If you find a style that
your are comfortable with, stick with it. Or, if you company has a set
standard use it. Otherwise, ignore what others are saying. Is is
non-productive.

I couldn't agree more!
 
S

Steven Cheng[MSFT]

Hi Steve,

I think tdavisjr has given you a quite good answer:

===============
If you find a style that your are comfortable with, stick with it. Or, if
you company has a set standard use it. Otherwise, ignore what others are
saying. Is is non-productive.
==============

Just coding as you like :)

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top