Over a million developers have joined DZone.

What is this ViewModel?

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Now I will explain a little bit about MVVM. MVVM is an architectural pattern. It stands for Model View ViewModel. Wikipedia has a decent explanation about it (http://en.wikipedia.org/wiki/Model_View_ViewModel)

The way I view MVVM is like this. It separates the Data(Model), from the presentation(View) and the ViewModel handles updating the Data when something changes on the View. It is useful, but I also feel if you are doing simple little apps you don’t need to use MVVM as it just takes up to much time and resources. But it is still a good thing to know and understand.

If you have checked out my previous posts and followed along, you should have noticed folders in the project that separated the Model, View and ViewModel out. If you wanted you could also check out the MVVM example from here (http://msdn.microsoft.com/en-us/library/ff431744(v=VS.92).aspx#BKMK_Common) also check out this short video if you want.

So if you start to notice in those examples, the view uses the ViewModel to get and set data to display and change, and the ViewModel updates the Model when it is saved. They do this as seperation of data and presentation. Separation helps with cleaner looking code and also has the ability to have a designer working on the View while a developer works on the data and that. But like I mentioned before if you are building a simple app, doing it in MVVM can cause a lot of overhead that isn’t really needed, but I still encourage you to try building an app with the MVVM pattern to get use to it.

I am still learning MVVM and have only had so much experience with it, but if you plan on really getting into WP7 application development, I suggest you read up on MVVM and try to build an app using the MVVM pattern. Any suggestions for me about MVVM or any questions please let me know.

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.


Published at DZone with permission of Andrew Conlisk, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}