Reputation: 50716
Everyone knows that Java's constant naming convention is uppercase with underscores between words, like USERNAME
and ERROR_CODE
.
But should words/names that are normally spelled in CamelCase also use an underscore? Should SomeBrand™ be named SOME_BRAND
or SOMEBRAND
? The latter can be harder to read and it doesn't convey the proper case, but the former can be incorrectly read as separate words, especially with another word attached (e.g. SOME_BRAND_ID
). Is there an accepted convention? Maybe a third option?
Upvotes: 1
Views: 2504
Reputation: 1243
In your case, I would use SOMEBRAND
. One reason is the same that jonmecer mentioned, because SomeBrand is treated as one word in a sentence. In addition, SOME_BRAND
could lead to confusion about its definition: do you mean you are talking about "some brand", or are you talking about your one and only SomeBrand™? Putting it as SOMEBRAND
clears up any confusion in that regard.
Upvotes: 1