I'm a beginner in programming web apps with Java EE. How do you name your packages?
I often saw stuff like com.abc.commons... is there a standard or a common way to do that?
Thanks to seanizer, I gonna use your approach: com.mycompany.myproject.api
These parts usually enter into my package names
example:
com.mycompany.myproject.api.services
// contains service interfaces for project myproject
com.mycompany.myproject.common.util.string
// contains string-related utility classes that reside in a library module
// that will be used by several other artifacts
One good practice is to have a common root package that is distinct for an individual project (jar etc). For example: in the jar myproject-api.jar , the root package would be com.mycompany.myproject.api
. That way you always know where to find your classes.
Yes, see the Sun Naming Conventions.
The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981.
Subsequent components of the package name vary according to an organization's own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names.
Examples:
- com.sun.eng
- com.apple.quicktime.v2
- edu.cmu.cs.bovik.cheese
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With