Monday, 2 November 2015

Introduction to MVVM for Windows phone 8.1


Model-View-ViewModel is developed by Ken Cooper and Ted Peters. It is mainly developed to simplify the event driven programming(i.e the mouse buttons clicks, key down, key up events)etc. 

Why MVVM?

It is mainly to separate the view and model in the applications. When our application needs to be changed without changing design of our application we can change the model. 

For example: When an application is updated from one version to other if the application uses MVVM architecture it happens easy to modify their code. 

Reusability of the classes, make the code light and efficient, bind the data from view to model and make the updates to the design with out  any changes.

It is easy to test the application when the developers follow MVVM architecture.

For a simple application it is not necessary to use MVVM architecture while it makes the code very complex. Assume an application with a buuton and textblock to display the text in button click it is not necessary to follow MVVM architecture. Because we are not adding any values or not updating the view.

In MVVM the data gets from other source like database, webservice or while we bind the data in the ViewModel to the view.

While we explain about MVVM these terms play a crucial role. They are
Model
View
ViewModel



Model is the core that implements the main logic of the view and view model. For example some classes defined in the model is used in the viewmodel.  

View is the user interface of the application.Data Binding plays the vital role .

View model is the layer of abstraction between the view and model. The entire logic is done in this view model.

No comments:

Post a Comment