My full variable name is Unique Code, however I want this variable to be "ucode"-ish.
So what would be correct concidering Java naming conventions?
- ucode
- uCode
- UCode
My full variable name is Unique Code, however I want this variable to be "ucode"-ish.
So what would be correct concidering Java naming conventions?
Variable names should start with a lowercase letter and every other word should begin with a capital letter. So
uCode
oruniqueCode
would fit with this convention.http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
Official doc for naming conventions: http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-135099.html#367
I would always start my variables with a lowercase and then capitalise each word, so I would go with 2 but would prefer to call it
uniqueCode
.See the coding conventions. For variables, camel case is recommended. Re. the naming, I would have thought
would be the most logical choice (I'm aware that wasn't in your list of choices). Any
uCode
variant looks like an abbreviation of unicode to me, and I would regard it as misleading. The above isn't an excessively long name (it's not an AbstractAnnotationAwareTransactionalTests, for example!)I perhaps wouldn't embed the usage/restriction of the variable in the name itself. If you refactor the usage then you'll have to change the name of the variable too.