MVC and MVVM Architecture

What is MVVM?
MVVM is Model View ViewModel.
Its a design pattern used widely with Silverlight and WPF applications.
We can say it as a successor of MVC pattern.
In MVC - Model View Controller , now controller is the view model.
View-Model is responsible for exposing the data objects from the Model in such a way that view objects are easily managed and consumed.

Why should I use MVVM?
1. MVVM is a great design paatern for UI.
2. Using MVVM you write better, lesser and more manageable code.
3. Being layered changes in UI/views donot majorly affect the other layers.
4. Using MVVM you can create a simple, testable, robust framework on which any WPF/Silverlight applications can thrive.

Difference between MVC and MVVM:
In MVC input is directed at the Controller first, not the view. Its a Controller that is interfaced with to kick off some functionality.
There is a many-to-one relationship between the Controller and the View. That's because a single controller may select different views to be rendered based on the operation being executed.

In MVVM,The input begins with the View, not the View Model.
While the View holds a reference to the View Model, the View Model has no information about the View. This is why its possible to have a one-to-many mapping between various Views and one View Model. View has no idea about the Model in the MVVM pattern.

Comments

Popular posts from this blog

Specify port number in ASP.NET Development Server

Server Variables in .Net Web Application

Free Windows Azure Exam