Design patterns for using with PRISM

Topics: Prism v2 - WPF 3.5
Jan 20, 2010 at 8:43 AM

Hello guys, I'm in some sort of confusion: at one hand Microsoft architects and surrounding web community promote MVVM pattern for building WPF apps, but from the other hand in Prism patterns and practices You (PRISM workgroup, which as I know is a Microsoft division) uses absolutely other design patterns - MVP, Presentation Model and Supervising Controller! And not a single example of use pure MVVM! You even say nothing about using MVVM in their PRISM documentation! So, what should one do in this situation? Is it possible to use MVVM pattern in PRISM applications with the same level of freedom as with patterns listed above? I mean would it be more complex or not because of (probably) kind a native architectural optimization for these patterns?

Jan 20, 2010 at 11:36 AM

Hi there,

As I understand, Prism guidance is meant to be UI pattern agnostic, but the documentation and samples do demonstrate how Presentation Model and Supervising Controller could be used. What might clear this up is to read this page on the history of MVVM.

In 2005, John Gossman, currently one of the WPF and Silverlight Architects at Microsoft, unveiled the Model-View-ViewModel (MVVM) pattern on his blog. MVVM is identical to Fowler's Presentation Model, in that both patterns feature an abstraction of a View, which contains a View's state and behavior. Fowler introduced Presentation Model as a means of creating a UI platform-independent abstraction of a View, whereas 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.

Note that much of the Prism documentation came together before the community reached consensus as to whether to keep the name MVVM or go back to Presentation Model. Here's just such a discussion.

So Presentation Model = MVVM, Supervising Controller = MVP.

It's definitely possible to use MVVM with Prism and it's quite common.

 

Jan 21, 2010 at 11:50 AM

I had the same problem as you regarding finding info on Prism and MVVM so I had a go at writing some simple templates that allowed me to play with MVVM and Prism.

You can have a look at my simple article in CodeProject on how I approached the MVVM.

http://www.codeproject.com/KB/WPF/SimplePrism.aspx

Hope this helps 

Jan 21, 2010 at 12:41 PM

Thanks, I'll check it out!