views:

120

answers:

4
  1. What is it in WPF and Silverlight that makes MVVM suit them so well?
  2. What is it in C++, or what does C++ lack, that makes MVVM and C++ never be mentioned together?
+5  A: 

MVVM (Model - View - ViewModel) is an adaptation of the MVP (Model -View - Presenter) or MVC (Model - View - Controller) patterns, both of which are very popular design patterns for C++ applications. The main changes to the design pattern are to better support WPF and Silverlight so it isn't so much that WPF suits MVVM, more that MVVM suits WPF.

Primarily the changes revolve around cleanly supporting the binding and command architecture present in the XMAL technologies through use of INotifyPropertyChanged and ICommand objects. Once again these changes wouldn't help in C++ since it doesn't have any native support for these high-level concepts. That isn't to say that you couldn't mimic all this functionality in C++, but on the way you would pass through using a basic MVP/C pattern and in most cases that is "good enough".

Martin Harris
+2  A: 

i think MVVM was designed specifically to support WPF. It looks like microsoft specifically developed the pattern to support the kind of Developer/Designer workflows they envisioned for WPF/Silverlight.

So the reason you probably don't hear about it too much outside of the WPF/Silverlight/XAML world is two fold.

  1. It was designed for WPF
  2. No one is trying to support (to the same extent) these designer/developer workflows in C++ gui frameworks.
luke
+4  A: 

It's nothing really to do with C++, or any language per se, it's more down to the fact that it only makes sense in a WPF/Silverlight context.

The only thing that MVVM brings to the table that other view/logic separation patterns do not is WPF/Silverlight commands/binding. The main reason for using MVVM is to leverage the powerful binding system built into WPF/Silverlight, it just doesn't makes sense to talk about it in different contexts, unless they have a similar model.

Steven Robbins
+1  A: 

In one word: Binding

Eduardo Molteni