software development

Java packages created by the domainless

The convention for naming packages in Java follows the principle of using the reverse order of an internet domain name. Thus, if you own the domain “wordpress.com” and create a Java library called “fubar”, the name of the package should be “com.wordpress.fubar”. But what if you do not own, nor want to own (or no longer have any interest in owning) your own domain name? How do you name your packages? The good folks at Sun designed this convention in order to guarantee uniqueness of package name, and as a side-effect it also provides a way to identify the package’s chain of custody (where it comes from). So even though there is nothing preventing you from inventing your own package name, for example “fubar. …”, there is nothing to guarantee its uniqueness, which of course is a potential problem if your package is redistributed, and it in no way identifies where or who from it originated.

Many people who do not their own domain name, and again, may have no interest in domain ownership, make use of free online hosting services. For example, my little place on the web is provided courtesy of wordpress.com. So in fact I *do* have a domain, it is akutz.wordpress.com. Following convention my packages should all begin with “com.wordpress.akutz” — this would guarantee uniqueness and identify the package’s origin. However, the question I am putting forward is this: is it appropriate for people such as myself to use a domain they do not own the root of, or more importantly do not have any organizational affiliation with, in naming a Java package? And if the answer is no, then what is the solution?

I propose that a possible solution is to establish a known prefix for packages that have no domain affiliation. For example, all packages should begin with “mailto” followed by the developer’s e-mail address in the familiar reverse order. A package developed by the user “littlemonstermike@gmail.com” would have a package name of “mailto.com.littlemonstermike. …”. This convention would achieve the uniqueness that Sun intended, and at the same time establish the package’s chain of custody.

Thoughts?

UPDATE

I posted the same question to the Java community forums, and it has generated some talkback.

Advertisements

One thought on “Java packages created by the domainless

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s