Why do I need MVVM for WPF / Silverlight, is there a good reason why I cannot use MVC?

Maybe I'm crazy, but I get MVC. It makes sense. MVVM seems like a way to make MVC more complicated, am I mistaken (if so, why?)?

+4
source share
3 answers

I think that if you get MVC then MVVM is really the same - with 1 extra part (ViewModel). The reason MVVM is more useful, in my opinion, is due to the new DataBinding processes. The ViewModel provides useful abstraction and clarity about what a data binding is and how that binding is represented or transformed. Thatโ€™s all thatโ€™s on my mind.

The missing part of MVC is actually in the MVVM pattern, this is just the hidden part of MVVM, in my opinion. If you look at most MVVM infrastructures, most of them provide some messaging or notification system that really provides the missing MVC control.

Think of the ViewModel as the code for your presentation, the presentation as the designer of your presentation, the model as a model, and the notification / message system as a controller, and we have an absolutely equivalent template.

It was a struggle for what I also understood (I was also from the MVC template, but now I love the MVVM template).

+2
source

Maybe this one is helpful.

+2
source

You don't need MVVM - it works well.

MVVM is just an alternative. You can use MVC. MVVM just uses some specific features in WPF and Silverlight (basically it is awesome support for DataBinding, as well as template and command) to make your life as a developer easier. MVVM is especially good as a decoupling of a view from code - all the more so since MVC, since using DataBinding, allows a designer to change a view much more efficiently without worrying about code changes than MVC.

MVVM also has close links to the fundamental design principles of WPF and Silverlight. The main idea of โ€‹โ€‹MVVM is very similar to the design of WPF and Silverlight at a fairly low level. For example, see how templates work with custom controls and compare them with the View / ViewModel section, and there are many correlations that can be drawn.

+2
source

Source: https://habr.com/ru/post/1316212/


All Articles