I do a lot of development in my own time. These projects I work on are all just for fun and learning (so far). I commonly do Java development with Maven but I have also been known to dabble in .NET and Python. All of the projects I work on use open source licenses, although most of them are not on any public code repositories.
Java/Maven development requires me to use a unique groupId
(e.g. “com.mydomain”) and a unique package
(directory) structure, usually containing the groupId
while .NET development encourages unique namespaces
in which I use similar conventions to the Java package
concept. To ensure uniqueness, I usually just use one of my domain names with the parts reversed (e.g. “ca.jessewebb”); I believe this is a very common practice.
I am in the initial stages of creating a new, open source, Java/Maven project (let’s call it “newproj”) and I would like to put it on GitHub. My username on GitHub is “jessewebb” so this will give it a URL like: https://github.com/jessewebb/newproj
. I don’t want to bother registering the “newproj.com” domain name so I decided to use “ca.jessewebb” and “ca.jessewebb.newproj” as the groupId
and package
, respectively.
It occurred to me that the presence of my personal identity in the code and as part of the project’s home (in the GitHub URL) will likely cause a potential contributor to think twice about getting involved with my project. This is a problem, I don’t want it to be my project. I would prefer if I could, instead, convey the message that I do not own the project. Now, in all honesty, it really isn’t that big of a deal because I doubt my projects will garner much community involvement but I also see this as even more of a reason to avoid any possibility of deterring would-be contributors.
For another example, I created a Google Code project a few years ago (let’s call it “oldproj”). When I created the project, I knew I was going to host it on Google Code so I used the groupId
and package name of “com.googlecode.oldproj”, which is the reverse of the default domain name Google Code provides every new project. This turned out to be a not-so-great idea; a year or so later, I moved the code to a different repo and I had to rename these identifiers (well I didn’t have to but…). At the time, I didn’t own any domain names and I ended up buying the domain name “oldproj.com” and I used it. I liked this because it gave the project its own identity and I wasn’t stamping my name on the code everywhere. I could have just as easily registered the “jessewebb.ca” domain name and used “ca.jessewebb.oldproj” as the package name but I didn’t because I had the same concerns back then too.
So my question is…
How can I avoid using my own (domain) names when creating open source projects while still maintaining uniqueness of packages/namespaces?
As projects gain more momentum, it makes sense to register the domain names but it seems silly and a waste of money to do this earlier on. I realize that I don’t actually have to own the domain name to use it in the code but that feels wrong and can lead to a squatter snatching it from under you in the meantime. What do other people do about this dilemma? Are there examples of popular (widely used, large community, etc.) open source projects that contain the original developer’s identity as part of its own identifier(s)?
2
In my projects, I give them a name but not necessarily a domain. So my package names (and namespaces) are usually just “projectname.libraryname”, regardless where the code is hosted.
I am used to .NET where this is handeled quite freely.
3
I can’t remember where I’ve seen it, but I’ve seen it suggested to use a structure like this:
YourIdentifier.YourProduct.YourComponent
YourIdentifier can be something like a domain you own, your (fairly unique) internet alias, etc etc. The component name is left off for “core” code of your product. For instance, I have a small MVC framework named BarelyMVC, so I have namespaces like these in it:
Earlz.BarelyMVC
Earlz.BarelyMVC.Authentication
Earlz.BarelyMVC.Caching
etc etc. Your online alias in most cases is plenty unique to avoid conflicts between other developers
If you’re afraid to use your own online alias, then create a “label” for yourself. It doesn’t have to be formally registered as a company or anything(or even a domain). For instance, the popular Json.Net
library uses the namespace Newtonsoft.Json
. It’s obviously based on the authors last name “newton”, but I don’t think anyone really cares about that. And if you do have a formal company registered, then you can of course use that. Most public APIs produced by my company for instance has namespaces beginning with PreEmptiveSolutions
, the name of the company
1
There’s no rule that Java package names or .NET namespaces be domain names. There isn’t even a requirement that they be unique, although that’s certainly a Good Idea. I actually think you were right to use com.googlecode.oldproj
, and in your shoes I wouldn’t have switched to com.oldproj
unless I was trying to get publicity for the new domain name.
2