Tuesday, February 21, 2012

MVVM Light

On a recent WPF project I had to choose a pattern to follow.  After researching WPF patterns I landed on MVVM.  I evaluated more traditional routes such as using the classic code behind event driven pattern taken from ASP.net.  However MVVM offers benefits that the code behind model just cant match.

Following the MVVM pattern your application is
- Testable the #1 reason to use this.  Ever try to write a unit test against a
- Blendable, or at least it can be based on the framework you use
- Decoupled design
- Simpler code, less code

After deciding that MVVM was the way to go, I had to decide on a framework.  I looked at a bunch, but they all seemed very complex to implement.  And I was working on a pretty simple application.  Wasting hours implementing enterprise type design did not make sense for this application.  Based on this criteria I decided on MVVM light.  It was easy to understand, and implement.  And had all of the key pieces I needed to implement the MVVM patter, but no more.
http://mvvmlight.codeplex.com/

NUGET
Of course you can get MVVM light through nuget in visual studio.  I cannot say enough good things about nuget, every Microsoft developer should use this!
http://nuget.org/

MVVM 
This is not just a Microsoft pattern, but it works well with xaml based applications.
http://en.wikipedia.org/wiki/Model_View_ViewModel

I will follow up with more details and a sample project for MVVM.




No comments:

Post a Comment