2

Is it good practice to use a free website as package identifier if I do not have a real website? EG com.weebly.vikarjramun.myapp.myactivity Just wondering...

2

2 Answers 2

3

A little background:

Companies use their reversed Internet domain name to begin their package names—for example, com.example.mypackage for a package named mypackage created by a programmer at example.com.

The reason of that convention is to avoid colissions since, jar files are treated as folders. If someone in a project have two jars with the same package hierarchy there maybe colissions.

This answer to a similar question offers good free, more ellegant alternatives using things that you control, like your GitHub repository or your StackExchange profile to give uniqueness to your package hierarchies if you don't own a domain.

3

The issue is not whether the site is free or not, but whether you control the domain or subdomain in question. If you don't control the domain name, there is a risk that you may lose it to somebody else, and if that somebody else is also a Java developer, you may end up with a package name collision. If you do own the domain name, it doesn't even need to be in use - as long as you own it, you can be pretty sure nobody else will use it as a namespace.

If the domain is a subdomain under a domain owned by someone else, you probably don't have any guarantee that you wont lose it, e.g. if the company closes shop and someone else buys the assets.

1
  • Thanks for your answer! Both you and Tulains Cordova answered my question, but as he gave some alternatives, I selected his answer Commented Aug 18, 2016 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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