(1) In desinging a the service layer, I find myself hesitant exposing my domain objects to the user
- Why? Some domain objects, (ie. Lease) have an expiry date(or any other attrib, hashed password) set by the service (biz logic). When a user queries a Lease, he can now modify the domain object then persist with a different expiry date.
- I am hesitatnt to put in checks to make sure the date's haven't been tampered with. And if there is a lot of stuff,
- Should I
[a]: Only pass in String,Date,int... values into the service and not the objects? Bascially the values that need to change + the id of the Object.
[b]: Some new DTO type object, that has those biz logic determined fields declared as immutable.
(2) Package structure:
- Constv give me some good structure hints for the service Tier. But what about the Controller/View layers?
- com.company.web.controller is OK, but what is the most elegant way of organizing a package for a web app (spring web app)