What package naming convention do you use for personal/hobby projects in Java?

I'm already familiar with the standard Java package naming convention of using a domain name to create a unique package name (i.e. package com.stackoverflow.widgets). However, I've never seen any recommendations for how to choose package names for personal projects. I assume because this is because this is really a matter of personal taste.

So, how do you choose package names for personal projects that will never make it into production (you might be experimenting with a new framework in your spare time). Assuming you don't have a personal website whose domain you can use to create your package structure, what do (or would) you do? Do you have a logical system in place for generating new package names for hobby projects, or do you just use simple throw-away package names like mypackage?

Since I'm just curious to see what different people's thoughts are on this, I've made this a community wiki.

For me personally, I've never given it much thought, but I wanted to play around with Wicket tonight and it occurred to me that I don't have a clear idea of how I want to organize my hobby projects. A separate, distinct package naming convention for hobby projects (in my mind, at least) would serve as a good way to keep personal and work-related code clearly separate from each other.

I was thinking of a simple hierarchal naming convention, to keep the source for my personal projects in a single root folder:

  • Use myprojects as the root folder
  • Append the project name
  • Add any additional subpackage names

So, my Wicket project would be in the package myprojects.learningwicket and unit tests would be in the package myprojects.learningwicket.tests (for example).


Solution 1:

If you're just doing personal projects where nobody else will use the code, then you can make up a package name that you like. Don't make up something that starts with com. or net. or other top-level domain though, because that would imply that you own the domain name (ie. using com.john as your package name just because your name happens to be John is not a good idea).

If you're going to give the code to anybody else, you should use a globally unique package name, which according to Java conventions means you should register and use a domain name.

Solution 2:

I just use my initials: fg.nameofproject.etc

It reduces typing. It can be prefixed at any time with sf.net or com. or org. or com.google..

As the project is personal treat it special just like your freshly pressed personalized gift shirt - it will feel good.

Solution 3:

<sarcasm> Bah. Any self-respecting programmer would have his or her own domain name. This is clearly a trick question. Everyone has their own personal domain name! </sarcasm> :-)

Ok, in all seriousness, buying a custom domain name is probably the easiest option. For about $10 a year, you can find reputable providers to host the domain and forward email.

Solution 4:

pmurray_at_bigpond_dot_com.project.package