2

I was tidying up some classes in my com.business.model package and realised every one of them was either directly annotated @Entity or was attached to one (I'm using Morphia). It occurred to me that the classes should actually be put in a com.business.entity package...

If this is more accurate (is it?) should I be putting my business logic classes into com.business.model and calling those from my jax-rs and jax-ws classes?

All my business logic classes are in the com.business package at present, which feels a rather anonymous place to be. Perhaps they are actually the models..?

(Note this project does not (yet) have a browser interface that a human would interact with, so referring to MVC would be somewhat premature.)

jmkgreen
  • 1,633
  • 14
  • 22

1 Answers1

3

I like to see the server architecture in this form:

client <-> service layer <-> business rules <-> persistence

So all classes related to services (servlets, web services, entry points, whatever) are placed on a package "services". All business rules, the intelligence behind the server, stay at "rules" or "business". All classes related to database, like entities and DAOs, goes to the "persistence" package.

All those three could go not only to different packages, but different modules (in maven) or even different projects. That's just a matter of how do you like to work.

Gilberto Torrezan
  • 5,113
  • 4
  • 31
  • 50