It's a generally considered a bad practice to use the Hungarian notation, but is common to find GUI controls named userNameTextBox and userNameLabel.
Do you put the control type in it's name? Isn't this a kind of Hungarian notation?
|
It's a generally considered a bad practice to use the Hungarian notation, but is common to find GUI controls named Do you put the control type in it's name? Isn't this a kind of Hungarian notation? |
||||
|
|
Like you say. In general, Hungarian notation is a bad practice. I like to keep my names as close to the domain as possible, but sometimes what you are trying to say is that this is the textbox and this is the label. See Kramii's answer to another question for his very reasonable take on why he still uses Hungarian in certain situations. As with all code, consistency and self evaluation is key. If you and your team agree on how different GUI-controls are labeled, and what elements need labels, you'll be fine :) |
||||
|
|
|
Our team is using Hungarian notation for GUI controls, not for the rest of the code. Typical example, a label followed by a textbox:
Plus it makes it easy to find your textbox, just type "txt" and intellisense will do the rest. |
||||
|
|
|
I know people can't stand Hungarian notation overall, but I still find it very useful in a lot of places. For GUI I use wnd prefix at least. The problem of not using Hungarian notation is simple, once you leave the smooth waters of MSVS, the navigation takes a nose dive. You see some sort of |
|||
|
|
|
I avoid using hungarian notation for GUI controls - I would avoid naming a control like `lblFirstName' because I don't really care that it's a label - from a data binding point of view it's just something to bind. For controls that need a name I usually add the prefix |
|||||||
|
|
I am using Hungarian notation for GUI elements. It really is the pain when you close QtDesigner, open Visual Studio and when you want to set text on button if you have textbox named In that case, |
||||
|
|
|
Actually I use Hungarian notation, only for GUI controls. I use something like lblText, rbGroup1, lvTable etc for labels, radio buttons and list views. They never tend to change anyway and it's clear what variable is a GUI control and what is not. However, since I use WPF with binding possibilities it is not really necessary anymore to name them at all, since it is binded to a C# property. Btw, don't make the mistake to call a control lvListViewPersons what I occasionaly see. If a variable is prefixed with lv you can see it is a listview already. |
|||||
|