What are some of the best options for organizing packages in a J2EE application?
I did some googling to find the answer but most of the pages talked about over all directory structure of J2EE applications and not how specific packages within src directory should be organized. Here are a few options I am aware of based on my work experience at a few organizations.
Pros: everything related to customer is in one package so it's easy to figure out business dependency
Cons: My technical artifacts are divided across packages and I don't know what each file might contain without opening it
We use option 1 at our organization, organize based on technical artifacts. This is also what I have typically seen other places. You know how every class in the package should be coded. I have not experienced any issues debugging business issues. Normally you know what service or action is involved and go from there. A problem with option 2 is sometimes classes, such as business objects, are shared between business processes, so which package would these objects be put under. I have never seen option 3, that sounds like way too many packages.