Niklas Therning wrote:
Michael Kearns wrote:
[X]: All capital
[ ]: Only the initial letter should be capital
It's English, and that's how english is written. It's how existing
classes within the Java API are written, and it's how the vast
majority of names were written before framework developers became lazy
when implementing autowiring of properties.

WellIAmQuiteSureEnglishIsNotNormallyWrittenUsingCamelCase. :-P

That's because whitespace is more important in full English prose ;)

In fact Sun isn't as consistent in their naming as one may think:

Java SE (5.0):

java.beans.XMLDecoder
java.net.HttpRetryException
javax.net.ssl.HttpsURLConnection
java.net.HttpURLConnection
javax.print.attribute.standard.PrinterURI
javax.print.attribute.standard.ReferenceUriSchemesSupported
(these are my favourite ones ;-) )
javax.sql.rowset.spi.XmlWriter.writeXML(...)
javax.sql.rowset.spi.XmlReader.readXML(...)


Java EE (1.4):

javax.enterprise.deploy.model.J2eeApplicationObject
javax.servlet.jsp.JspContext
javax.servlet.jsp.JspWriter

So they don't seem to be able to decide whether it should be Xml or XML,
URI or Uri. They always seem to use HTML, Http and Jsp. :-)


Oh, I agree, even if in general it's the later extensions (javax.) that break the naming conventions more, but that's down to Sun getting more lax in enforcing naming standards - A good testcase is actually the

java.net.HttpURLConnection

This is a very tricky situation, because HTTPURLConnection is very unreadable. However a far simpler solution is to make the class URLConnection in an http sub-package (and before you start, package standards of all lower case should definitely override Acronym 'upper-case-ness').

Because naming is so inconsistent across software, I think it's easier to stick to Acronyms being consistent with their native language structure, so it's obvious what they are. Their most recognised form is their upper case presentation. If it's causing problems with the classname, just think of a more appropriate classname. Most style guides recommend avoiding Acronyms wherever possible for this very reason.

Whichever decision is taken, does it mean the entire source codebase is going to be refactored to the new standard ? Consistency is far more important than which approach is taken.

Michael.

Reply via email to