Question

This is more about best-practices, but how should the top-level domain of a java package(ex: com.foo.bar, where com is the top-level domain) be determined or decided? I know com is used in most corporate packages, but is there a list or resource I can use to determine the uses of other package based TLDs?

No correct solution

OTHER TIPS

Generally speaking, the root of your package hierarchy should reflect a domain name under the control of the entity producing the code. It's very cheap to purchase your own domain name if you're producing code on your own, but if you can't or don't want to, it's routine to use net.sf.fooproject for projects hosted on SourceForge and com.github.fooproject for projects on GitHub.

A common (and good) practice is to use the domain of the company the app is developed for, inverted and followed by the project name.

I.e. if you make an app for stackoverflow, your package should start with com.stackoverflow.projectname ...

However, the really important thing, is to avoid collisions between class names (that include their packages).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top