Monday, January 25, 2016

What's the benefits of using MVVM over MVC?

The MVVM pattern provides two-way communication between the pattern parts, whereas MVC is able only to provide one-way communication. The main advantage relates to using an additional layer of non-visual parts on the Model top. It helps a developer to map data closer to the View parts.........
MVC is suitable for web apps where you can write the entire application in C# to work on a browser.  Since in MVC View is smart and knows about the model and works on the properties of the model, can even call methods of the model (using Razor) it is lot more convenient to use.
However in MVVM, Views don't have access to the real model and has only access to a special ViewModel which contains only data that can be used for UI, and is designed so that one can have different views for the same ViewModel, for example, a mobile app designed using Xamarin that can run on Andrioid, iOS, Windows Phone.
Both have their usages.  Essentially they are the same concept with slightly different flavor.  In MVVM, you dumb down model even further, so that it carries only presentation level data that can be displayed on any device and one can collect data from any device.