MvvmCross

In the seventies, just before I was born, Xerox (where I spent half of my career) invented MVC (model-view-controller). There are many variations of the pattern one of which is MVVM (model-view-viewmodel). While the differences between the various flavors of MVC, MVP, MVVM, etc. are in my opinion purely academic, there is absolutely no doubt in my mind that following a pattern like that can make the dev’s life a lot easier. There is somewhat of a high price for entry and a bit of a learning curve, but once you commit to it, there is no going back.

The essence of MVVM is that you separate your data (the model) from you presentation (the view) and you put all your UI logic in the view-model, where it can be developed and tested separately from the view itself. When targeting multiple platforms, in the ideal case you can reuse your models and view models across the different platforms and only code separate views.

There are several different MVVM libraries (MVVM Light, Caliburn, etc.) but it is important to understand that you do not need to bring a library in order to do MVVM, it just makes things easier. I’ve never used mvvmcross before but it promises to deliver databinding on windows, android and ios with reusable view models. It also contains a simple IoC container as well as few other tools and plugins.

mvvmcross is available as a nuget package. you add it to your projects, follow the provided (short) to-do list and you are in business. I was able to wire up a win store app with two views, view models, a service, etc. in maybe 15 or 20 minutes. Tomorrow – droids for breakfast 🙂 …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s