Dion wonders whether you need fully qualified package names on your java packages. For instance, is code that I write with this package declaration: package com.mooreds.foo; that much better than package mooreds.foo;?

Given that there are no other mooreds MLDs (from a search at network solutions):

mooreds.net is available.
mooreds.org is available.
mooreds.info is available.
mooreds.tv is available.
mooreds.us is available.
mooreds.cc is available.
mooreds.name is available.
mooreds.bz is available.
mooreds.co.uk is available.
mooreds.de is available.
mooreds.be is available.
mooreds.co.nz is available.
mooreds.at is available.
mooreds.com is unavailable.

I think the answer is that it doesn’t matter very much right now. And the chances of it mattering in the future are slim. I’d have to write some code with the same classname as another ‘mooreds’ packager, and want to import that code. Improbable, but possible. And if this situation arose, I’d have to rename my class, use a different package name (after all, packages don’t have to be meaningful) or use a different class.

What are the benefits of leaving off the com. declaration? Well, it saves everyone who wants to use it four characters of typing per import (those who don’t use auto importers). Four characters!

So, it’s safe to say that package mooreds.foo; and package com.mooreds.foo; probably won’t hurt anything, but given the cost benefit analysis, I can’t see why anyone wouldn’t use the full package declaration: package com.mooreds.foo; .

Now, if someone is using a domain they don’t own, well, that’s just braindead. 15$ and a credit card will get you a domain name. If you can’t afford that, then choose a TLD of your own creation; package lalala.mooreds.foo; won’t collide with anyone who is following the spec, and has an even smaller chance of colliding with someone who isn’t than just dropping the TLD.

In a different vein, I used to give an unusual name for restaurant waitlists, but oftne when they called out ‘Archibald’ I wasn’t attuned to it like I was to ‘Dan’ and more often than not, I missed my seating. Similarly, if you use a domain that someone else owns as your package name, well, you’re looking for trouble that you don’t really need to. I mean, really, isn’t software hard enough?

© Moore Consulting, 2003-2021 | Twitter