Search code examples
javanaming-conventionscamelcasing

Acronyms in Camel Back


I often see Java class names like

XmlReader

instead of

XMLReader

My gut feeling is to completely upper case acronyms, but apparently many people think differently. Or maybe it's just because a lot of code generators are having trouble with acronyms...

So i would like to hear the the public opinion. How do you capitalize your class names containing acronyms?


Solution

  • We use the camel case convention like Java and .NET do. Not for reasons of code generators, but for readability. Consider the case of combining two acronyms in one name, for example a class that converts XML into HTML.

    XMLHTMLConverter
    

    or

    XmlHtmlConverter
    

    Which one do you prefer?