Hi All,
After much more reading I only have more questions.. Lets say I have defined a bunch of Entities in my domain model. To help me create a rich domain model I have removed all setters and getters and for the moment I have a protected constructor. Not a problem for hibernate since it can still access the fields.
(Some setters/getters might come back but this helps me think about the methods of entity a little better)
One of my entities is a User class. It has things like firstnam, lastname, address etc...
So now I need to create a new user and to do so I need to pass the required information into the class one way or the other, here are my alternatives:
1. Put some setters back
2. Use a constructor
3. Create a "VO" and pass that as an argument to a method of User
4. Add various methods to the User class which take "groups" of fields as arguments. For example a method for address(address1, address2, city, zip, country) and one for fullname(firstname, lastnam)
Hmmmm are there other options?
3. might be an option but now I creating more work for myself, do I really need to do this.. 1. might be ok as long as it makes sense.
So I have 1 and 4 to think about, anyone have any thoughts so far?
An additional problem is what if I would like to bind my forms directly to domain entities? Is this a no no?
OK So here again I can create these sort of "proxy" value objects that get bound to the form and are used to populate an Entity class, but do I really need to?
I have read lots of discussions in the forums and in some books but there does not seem to be a simple guideline that attacks the problem from start to finnish... sighhhh
I would be most greatful for any comments.
Thanks,
Serge


Reply With Quote
