Naming Conventions For Class Containing Acronym

If I called a new class in OOP, what is the best convention:

  • XMLWriter
    • Most often
  • XMLWriter
    • Easier to distinguish
  • Xmlwriter
    • No longer an acronym
  • XML_Writer
    • Deletes a point with a camel case

Pedantically yes, but I'm curious who uses what.

+4
source share
3 answers

Currently, Java conventions look in favor of handling well-known abbreviations such as words, therefore: "XmlWriter" ...

http://www.ibm.com/developerworks/library/ws-tip-namingconv.html

Java assignment convention with abbreviations <-dupe question?

http://geosoft.no/development/javastyle.html

But no one seems very consistent. For example, take the JavaScript XMLHttpRequest. What a trip!

+5
source

I am pretty sure that all the naming people will want to impose this on me. But, in my opinion, the naming convention you should use should be the easiest to read. Names are used only by people, so they should be the easiest to read / understand. Therefore, for things like XMLWriter, I would suggest that it is an XmlWriter, as it seems a little easier to read. For things that are very common (i.e. XML), I think that treating it like a word is best. If you have an abbreviation specific to your domain, then I could use it so that people who do not use it all the time understand that it is an abbreviation. Basically simplify understanding of the real intentions of names, even if it makes reading difficult. I think common sense and better judgment are better than trying to stick to an absolute set of naming rules. Although naming should best follow a reasonable set of naming conventions.

+2
source

I would say that you should always give preference to the most readable (as lightning said) and at least capitalize the class name, as I read somewhere that this is the standard Java convention, and I also feel that starting with a large letters are always made you sure its a java class.

+1
source

All Articles