Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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)?

share|improve this question
1  
Whoa, quite lenghty, but still a good question! –  Marcel Feb 1 '13 at 22:23
1  
Use a UUID in your packages/namespaces? ;-) –  Jeroen Feb 1 '13 at 23:06

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
    
I think this a good solution when I don't have or (immediately) want a domain registered for the project. I could even do this when I do have a domain. It would even help make sure I use unique project names, which never is a bad thing. I will probably accept this answer soon, unless any better ones come up. Thanks! –  Jesse Webb Feb 4 '13 at 9:00
    
Yeah, .NET programmers do this, but it isn't a good idea. If the project name is a made-up word, it can work out OK, but I wish I had a dollar for every "Downloader" or "Browser" project I've seen. –  Ross Patterson Feb 4 '13 at 12:21
1  
I've started using this strategy for all my projects. I come up with a unique name for the projects, almost a code-name (pardon the pun), and use it for my packages/namespaces. Saves me having to worry about domains names, at least until the time comes when I want one. –  Jesse Webb May 6 '13 at 20:48

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

share|improve this answer
    
Very common in the .NET world, where the backwards-domain-name thing never really caught on. And as long as "YourIdentifier" is seriously unique, it works. But even Newtonsoft is only accidentally unique - James Newton-King doesn't actually run such a company, and it's trademark would only exist in New Zealand if he did. –  Ross Patterson Feb 4 '13 at 12:24

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.

share|improve this answer
    
I realize there is no rule that you have to use domain names, but I think it is a very common practice, at least in the Java and .NET world, just because it helps ensure uniqueness. Also, you said you think I was right to use com.googlecode.oldproj, why do you think this was a good idea? In retrospect, I thought it was kinda of silly to tie the code to the hosting provider. –  Jesse Webb Feb 4 '13 at 8:58
1  
The point isn't that it ties you to some hosting provider, the point is that it is a conventionally-unique identifier that is peculiar to this project. Which is all "com.jesseweb.oldproj" is, technically. So since you didn't want your name attached to it, it was a good decision. Java packages and .NET namespaces aren't supposed to be signposts directing you to a download site etc., just an identifier that is unique by convention. –  Ross Patterson Feb 4 '13 at 12:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.