views:

28

answers:

2

In IDEs like QtCreator or with Visual C#'s form designer, I'd like to hear whether labels "should" be named or just left with the default naming scheme from the form designer. If the object is not going to be touched in code and only serves as non-changing textual information, does the object need to be part of some naming scheme? If I have a label above a text field that the user enters their name in, should I name that label "lblNamePrompt"?

Just curious to get some responses.

+2  A: 

If the object is not going to be touched in code and only serves as non-changing textual information, does the object need to be part of some naming scheme?

I wouldn't give it a name if I am not going to use it.

Because I am lazy and because if something works as it is, I ain't going to fix that something.

devoured elysium
A: 

I think keeping the code clear even if you are not going to touch it "never" (notice the double quotes) is a good practice. I will recommend to give a good name to it.

Im not a .NET programmer, but I've seen in some code is that they use names like:

For:

Labels:

  • lblFirstName
  • lblLastName
  • lblAddress

Buttons:

  • btnSend
  • btnCancel

I'm very PRO-YAGNI. But I think it worth to give objects a name that references it purpose/usage.

Garis Suero