[jianqiang] 2. Does ViewModel need a Presenter?
Presentation Model and Model-View-ViewModel are
Martin Fowler teaches us in his article on
GUI Architectures in 2006 (about the time Microsoft's John Gossman coined the phrase MVVM for WPF) that the Presentation Model evolved from MVC, the noted limitations of the Presentation Model "helped develop the Model-View-Presenter
approach". John Gossman introduces even more limitations in his
Tales from the Smart Client article which suggest MVVM may not be well suited for small or Enterprise applications.
It is my experience with Enterprise level applications that PRISM, more specifically Dependency Injection, the Presentaiton Model opens the door for even more issues. Reusability and loose coupling... As Martin Folwer notes in
his Presentation Model article, each view should have only one Presentation Model, Presentation Models can be shared by more than one View. Since different views can have different algorithms for calculations the Presentation Model can become bloated
and/or impractical for reuse and can lead to duplication (more complexity and inconsistencies) - reference "Patterns of Enterprise Application Architecture" by Martin Fowler, Domain Model (116).
A Presenter levels the playing field. Common entities and behaviors can be placed on a Presentation Model (reusable) and Presenters, using dependency injection, can specify the Presentation Model it will be using (loosely coupled). Presenters
can encapsulate domain logic that is specific to a use case.