Model-View-ViewModel is an architectural pattern mainly used in WPF, Silverlight and WP7 development whose aim is to virtually remove all the code-behind from the View layer. Interactive Designers can focus on UX needs using XAML and create bindings to the ViewModel, which is written and maintained by application developers.
MVVM is a specific implementation of the more general Presentation Pattern. MVVM ViewModel comprises of conceptual models rather than data models, and all the business logic and other operations are done within the Model and the ViewModel. There are many Frameworks which enable this. Some of them are -
Open Source
- PRISM – provided by Microsoft. Works with MEF/Unity for dependency injection, has composite commands and is extensible. Detailed tutorials and walkthroughs at MSDN.
- MVVM Light Toolkit – has Project and Item templates for Visual Studio and Expression Blend. Read more here and refer tutorials on working with VS and Expression Blend.
- Caliburn Micro – supports ViewModel-First and View-First development, Asynchronous programming through co-routines.
- Simple MVVM Toolkit – provides VS Project and Item Templates, Dependency Injection, support for Deep cloning and Property Association between Model and ViewModel
- Catel – includes Project and Item templates, user controls and enterprise library classes. Supports Dynamic View Model injection, lazy loading of view models and validations. Also sports WP7 specific view model services
Closed Source
- Intersoft ClientUI – paid – supports only WPF and Silverlight, although, apart from MVVM framework, it also provides several other features.
- Vidyano – free but not open source. Has Entity mapped/virtual Persistent Objects (data containers), business rules and in-built ACL based security
For an introduction to MVVM, refer to the following material -
- Understanding MVVM Pattern and Deep Dive MVVM by Laurent Bugnion
- Understanding the MVVM Pattern in Silverlight Applications by the MS Silverlight team
- Presentation Pattern – presentation by Erik Lebel on InfoQ
One of the biggest benefits of using MVVM is the separation of concerns, so that the UX designers and the Application developers can work in parallel. On the other hand, concerns are that it is an overkill for simpler UI operations, data-bindings are somewhat harder to debug and potential performance issues if large number of bindings are used.