If I am naming a new class in an OOP language, which is a better convention:
Pedantic yes, but I'm curious who uses what and why.
Java conventions seem lately to favor treating well-known acronyms like words, so: "XmlWriter"...
http://www.ibm.com/developerworks/library/ws-tip-namingconv.html
Java Naming Convention with Acronyms <-dupe question?
http://geosoft.no/development/javastyle.html
But nobody seems to be very consistent. Take JavaScript's XMLHttpRequest for example. What a trainwreck!
I'm pretty sure all the different naming convention people will want to string me up for saying this. But in my opinion the naming convention you should use should be the one that is easiest to read. Names are only used by humans, so therefore they should be whatever is easiest to read/understand. So for things like XMLWriter, I would probably put it as XmlWriter since that seems a little easier to read. For things that are very very common (i.e. XML) I think treating it as a word works best. If you have some acronym that is specific to your domain, then I might capitalize it so that people who don't use it all the time would understand that it's an acronym. Basically make it easier to understand the names real intention even if it makes it slightly harder to read. I think using common sense and best judgment is better than trying to stick to a absolute set of rules in naming. Although the naming should try it's best to follow a reasonable set of naming conventions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With