Yes, the Model could be essentially any Model. The way I see it, the original intention of MVC was that it is a Domain Object, and that is certainly still possible However, my experience have shown that a better fit is achieved if we introduce a specialized ViewModel/Presentation Model as a insulation between the Domain Model and the View Even when the ViewModel seems to be semantically identical to the Domain Object, such an insulation enables us to vary the two independently and thus follow the Single Responsibility Principle It often turns out that the View needs some logic that applies to the specific UI technology, and this logic fits badly in the Domain Model. Examples include Logic that determines if a particular control should be enabled or disabled.
Domain Models should know nothing about controls Logic that maps a state to a color. Colors are technology-specific - they are different CLR types across Windows Forms, WPF and ASP. NET Validation.
Input forms normally allow input of invalid data without throwing exceptions. Instead, they provide feedback to the user that the data is invalid. Domain Objects, on the other hand, should protect their invariants, and thus throw on invalid input More information can be found here http://stackoverflow.com/questions/1991120/viewmodels-and-rendering/1991151#1991151 http://stackoverflow.com/questions/1908739/best-practices-for-creating-libraries-that-use-net-namespaces/1908797#1908797.
Yes, the Model could be essentially any Model. The way I see it, the original intention of MVC was that it is a Domain Object, and that is certainly still possible. However, my experience have shown that a better fit is achieved if we introduce a specialized ViewModel/Presentation Model as a insulation between the Domain Model and the View.
Even when the ViewModel seems to be semantically identical to the Domain Object, such an insulation enables us to vary the two independently and thus follow the Single Responsibility Principle. It often turns out that the View needs some logic that applies to the specific UI technology, and this logic fits badly in the Domain Model. Examples include Logic that determines if a particular control should be enabled or disabled.
Domain Models should know nothing about controls. Logic that maps a state to a color. Colors are technology-specific - they are different CLR types across Windows Forms, WPF and ASP.NET.Validation.
Input forms normally allow input of invalid data without throwing exceptions. Instead, they provide feedback to the user that the data is invalid. Domain Objects, on the other hand, should protect their invariants, and thus throw on invalid input.
More information can be found here http://stackoverflow.com/questions/1991120/viewmodels-and-rendering/1991151#1991151 http://stackoverflow.com/questions/1908739/best-practices-for-creating-libraries-that-use-net-namespaces/1908797#1908797.
Thanks for that great explanation. My intention was to have the controllers query the domain and a helper(some sort of mapper/assembler) build a presentation specific view model, would you agree that this approach is correct? – David Jan 9 '10 at 11:36 Yes, hit the Domain Model to retrieve whatever you need, use a Mapper to map to the ViewModel, and render the View using that ViewModel.
That's essentially what I do as well. – Mark Seemann Jan 9 '10 at 12:10 Thanks again Mark. I have some other questions around this subject that I'm going to pose and would appreciate your input.
– David Jan 9 '10 at 12:15.
Needed to be split, so I have separated it into Supervising Controller and Passive View. Of Model-View-Presenter in the context of UI architectures here.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.