1

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?

shmosel
  • 49,289
  • 6
  • 73
  • 138

2 Answers2

1

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.

17slim
  • 1,233
  • 1
  • 16
  • 21
0

According to sun each word should be separated by "_". Now when you type SomeBrand in a sentence, you would treat it as a word. So, I think SOMEBRAND works better. But then again, this is based on your company's policy.

jonmecer
  • 611
  • 6
  • 15