以上好多人说的都不太对。其实Prism模式和MVVM也好MVP也好是没有关系的,MVP,MVVM侧重于UI表现层和逻辑层以及低层的层次分离,也就是横着切,而Prism解决的是模块之间的独立和组合的问题,也就是竖着切。横切是竖切是不冲突的。实际情况下Prism和MVVM或者MVP是组合使用的。比如微软自己给Prism写的那个Sample程序StockTradder就是Prism和MVP的配合,但既……
[/Quote]
听说Prism v.4好像要用MEF替代Unity, 而且整个实现都会向MVVM靠, is it true?
MVP is a variation of the MVC pattern. The view relies on a Presenter to populate it with model data, react to uer input, provide input validation(perhaps by delegating to the model), and other such task.
Presentation Model(PM) is similar to MVP in that it separates a view from its behavior and state. The interesting part of the PM pattern is that an abstraction of a view is created, called Presentation Model. A view, then ,becomes merely a rendering of a Presentation Model. The Presentation Model frequently updates its View, so that the two stay in sync with each other. That synchronization logic exists as code in the Presentation Model class.
MVVM is identical to Presentation Model, in that both patterns feature an abstraction of a View, which contains a View's state and behavior. Martin Fowler introduced Presentation Model as a means of creating a UI platform-independent abstraction of a View, whereas John Gossman introduced MVVM as a standardized way to leverage core features of WPF to simplify the creation of user interfaces. In that sense, I consider MVVM to be a specialization of the more general PM pattern, tailor-made for the WPF and Silverlight platforms.