Hi there,
The naming convention you are referring to is called Hungarian notation where the variable is prefixed with its type. So, an integer called Age would be iAge, a name would be sFirstName and so on.
Given the great capabilities in IDEs like Visual Studio, this is no longer recommended. You simply hover over the variable and you'll see its type. So you're recommended to use names like age and firstName instead. This makes your code easier to read and maintain.
You can use the same mechanism for web controls. When used in Code Behind, just hover and you see the type. For controls the naming mechanism is slightly more complicated. If you think of "Country" you can imagine it's a string data type so you wouldn't need to hover over the variable. But by which control is it represented? A TextBox? A DropDownList? You can't really tell and that's why I suffix them with the control, or a generalization of the control (e.g. GenreList represents the genres in some list control; I may not care that much about the exact control that's being used).
In previous versions of the book I did use prefixes such as btn and txt. In this version I only use the conventions described above, except for cases where the name doesn't really matter and I leave the default name in place (TextBox1, DropDownList2 etc).
Remember: this is just a naming convention. If you don't like it, pick something that works for you. Being consistent is far more important than the actual convention you choose.
Cheers,
Imar
|