I've seen arguments for and against Systems Hungarian. For some years I've been working on a legacy project that uses this system by naming every variable, function with a prefix of the variable type eg (strName, intAge, btnSubmit etc) (I know the original Hungarian Apps prefixes by the kind of variable, not the type). I'd like my next project to abandon it fully, but I do find it harder to name similar things uniquely without resorting to it.
Lets say I have an webform for collecting email addresses and storing them in a database table, and button which calls the function which save the address to the db.
If I'm using Hungarian style notation, I might call the box
txtEmail the button
btnEmail and the value contained in the textbox
strEmail. I might then use a function
storeEmail(strEmail) to store the email. I have a clear convention here, it's obvious what each variable is.
What would be the best practice for naming these variables
- without resorting to Hungarian Systems,
- without making them over long or confusing
- and with a clear convention to use across the whole of my project?