I've had quite a few problems with naming conventions in the past (as I’m sure a lot of you had) and now i'm trying to find the best set of rules i can always follow to be more consistent.
The problem is not that big when just using the same language like when using Java it is absolutely clear to me that the best practice is to use camelCase naming system. But what about when read a value from a field in a database. The field name is probably going to be in lower case separated by _ (field_name). Therefore, it kinda makes sense to call a variable that gets that value "field_name". I used this logic for my PHP scripts, until i started using some classes, and using phpDoc so it works much better using Java naming conventions.
There was also something I’ve seen in quite a few programing books I read, called the Hungarian notation. I found this to work great with visual c++ for user interface components, giving them a name such as lblFirstName and txtFirstName is very nice when you want to validate a form for example and highlight any problems with the data . This principle also works well in other languages such as Java and is also good for HTML/Javascript form validation.
But again there is a problem to how far to actually take this. The following rules seem to work for the most part:
1. Data related components(file names, database design, XML, HTML tags) should use a lower case names separated by an underscore (_).
2. Data components related to programming(programming languages) should use camelCase.
3. GUI components that will be manipulated by the program(HTML and GUI classes in some programing languages) should use Hungarian notation.
However, I still find myself breaking them every once and a while, sometimes they don't make much of a sense.
So I guess my question to you is how do you deal with this? What set of rules do you follow?
Do you believe that every language or every situation needs to adhere to different naming standards? or a universal standard needs to be created?
P.S.
I didn't even talk about abbreviations and too wordy names.
Here is some information I found in Wikipedia:
http://en.wikipedia.org/wiki/Identifier_naming_convention.