Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is it in MVVM that makes it particularly appealing for managed WPF and Silverlight but not native C++?

  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?
like image 697
Johann Gerell Avatar asked May 27 '10 08:05

Johann Gerell


2 Answers

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 XAML 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".

like image 197
Martin Harris Avatar answered Sep 30 '22 00:09

Martin Harris


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.

like image 35
Steven Robbins Avatar answered Sep 29 '22 23:09

Steven Robbins