Java ist auch eine Insel

Freitag, Januar 11, 2008

Inconsistent lower/uppercase abbreviations in Java type names

Library

Uppercase Variant

Lowercase Variant

Special Case

Java SE

GZIPOutputStream

ZipOutputStream

HttpURLConnection

DGC

MidiSystem

StAXSource

AWTError

JdbcRowSet

 

HTML

Clob, Blob, NClob

 

ImageIO

 

 

JAXBContext

 

 

JMXConnector

 

 

JPEGImageWriteParam

 

 

PBEKey

 

 

RMIClassLoader

 

 

RSAKey

 

 

SAXParser

 

 

SOAPElement

 

 

SQLException

 

 

SSLContext

 

 

UIDefaults

 

 

URI, URL, PrinterURI

ReferenceUriSchemesSupported

 

Java EE

XMLEvent

XmlElement

W3CDomHandler

XMLOutputFactory

XmlSchema

 

XMLType

XmlType

 

EJB

Xid

 

ELResolver

JspTag

 

HTTPBinding

HtmlMessage

 

JAXBElement

SqlResultSetMapping

 

JDBCStats

HttpServlet

 

JMSSessionStats

 

 

JVMStats

 

 

SAAJResult

 

 

SOAPBinding

 

 

URIValidator

 

 

XAConnection

 

 

Spring

MessageEOFException

JmsException

 

OC4JJtaTransactionManager

JmxUtils

 

SQLErrorCodes

SqlCall

 

SQLExceptionTranslator

SqlFunction

 

URIEditor

UrlResource

 

 

JndiRmiClientInterceptor

 

 

JpaTemplate

 

 

JstlView

 

 

MimeMailMessage

 

 

SimpleJaxWsServiceExporter

 

 

XmlBeanFactory

 

Apache Commons

NTPUDPClient

NtpUtils

HttpURL

FTPClient, POP3Client

HttpClient

 

SimpleSMTPHeader

 

 

NTLMScheme

 

 

RFC2965Spec

 

 

URI

 

 

 

What is your favourite example or inconsistent usage?

 

 

Werbung: Wir haben neue Java-Seminare!

AddThis Social Bookmark Button

2 Comments:

  • I prefer the lowercase variant because it's easier to read within a lot of class names. For example NtpUdpClient is more readable than NTPUDPClient. But I think it's a matter of taste and only important in a project with more than one developer.

    By Anonymous Thomas Zuberbuehler, at Januar 11, 2008 5:09 PM  

  • The inconsistency is a pain but kind of inevitable. There are just so very many abbreviations, and some just look wrong done one way or the other (sometimes depending on previous or next word). Then there's also sometimes a more general non-Java accepted practice for a particular abbreviation, so it looks wrong if done the other way. Lots of people, lots of APIs, it won't be done the same.

    I tend to agree that lowercase is usually clearer and a bit easier to use consistently. But then you have the Servlet API where method names using "Url" have been officially deprecated and replaced by ones with "URL" - in the name of a supposed convention to now use the upper-case form. Though it's still all "Http...".

    But the one that really, really annoys me is where JNDI "URL context factory" classes have to have names that start with the lower-case protocol name (e.g. "httpURLContextFactory" - hey look, both conventions in the same name!). And I vaguely think there are one or two other such APIs that enforce this kind of convention as part of how they "find" classes. It completely contradicts the platform's overall normal conventions, looks silly amongst a pile of other classes, and of course is reported by code-checking tools as obviously a mistake...

    By Blogger Mike Kaufman, at Januar 11, 2008 10:44 PM  

Kommentar veröffentlichen

<< Home