Question

I know that the best practice to name java packages is to use a domain name backwards.

But suppose my domain is in the form www.word1-word2.com. When I try to create a package in eclipse or Android Studio named com.word1-word2.Myapp, I receive an error message (the - character can not be used).

An alternative is to use com.word1_word2.MyApp... but the bad new is that these domain is registered to another person.

Wich alternatives do you recomend me?

Thnks.

Was it helpful?

Solution

Is that other company also offering Java packages? If not, you shouldn't care that much, since your issue would be that a client would use your package plus the competitor package, and that both packages contain a class with the exact same name.

C and Objective-C developers build libraries for clients without wondering that much of package name uniqueness, since there are no package names.

If you want, just add a little something to the package name, like com.world1word2.productname.

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