I am about to start a new project and I am undecided on how to link my presentation layer with Domain objects.
Traditionally I have used DTO which means for each Domain Object, there is corresponding DTO. This approach is a overkill and want to see what you guys are doing.
I can think of 3 options and any feedback on this will be much appreciated:
1. Use Domain object directly in the presentation. But this means now the UI can do anything with the domain object such delete, update etc if I am using OpenSessionInView pattern.
2. Use Domain object without OpenSessionInView and any update/loading has to be done within a transaction scope, This means UI can do anything with the Domain object but nothing is made persistent yet until save/update call is made withing a transaction scope. Validation happens before domain object is re-attached/merged with the session.
3. Use ViewObject per page which represents the data needed only to interact with that page. This View Object is similar to DTO except the View Object only contains what it needs to handle the page.
With this 3 options I have confused myself to a level where I can't decide which approach is better.
Any suggestion or pointers would be appreciated.
Thanks in advance.