Is that acceptable to pass directly domain model entity to UI layer instead of corresponding viewmodel?
In my example UI gets some user data and passes it down to presenter which interacts with domain service. Domain service performs some action on the data from the user and returns output results back to UI as domain model entity, which should be typically converted to viewmodel.
The problem is that depending on the user choice (Y or N) inspecting the returned result, it may be returned back to the service for further processing and finally saved to repository.
If we do not save returned domain entity somewhere between those 2 steps, but use viewmodel, we will not be able to pass it back for further processing.
Are there some workarounds when such user interaction takes place?
MVPis defined around the concept ofView,Presenter, andModel. There’s no reason you need to distinguish between a domain entity and a viewModel. They can (and should) be the same thing.Unlike
MVVM, the model plays less of a role in binding to theView. It’s the responsibly of the presenter to manipulate the view using the model data. There is no concept of aViewModelas such in MVP. That term is generally reserved forMVVMwhereViewModelis an entity tightly coupled toView, in addition to having aModel.