Quick, what’s the most popular thing in XAML development? Yeah, thought so…MVVM or Model-View-ViewModel.
It’s one of the most popular subjects I hear about when people talk about developing applications with WPF and Silverlight. However, as much as it is talked about and as much as frameworks are born every day, there isn’t a ton of just simplified ‘here’s how you do it’ information in one place. I mean, sure there *is* information, but I have to admit I think it is a bit scattered all over.
One of the pioneers of promoting this pattern for WPF development, Josh Smith, took some time to try to solve that. Josh has recently released a self-published book titled Advanced MVVM and is a quick and good read about the pattern.
FULL DISCLOSURE: Josh presented me with a complimentary printed copy of this book a few weeks ago. I had already intended on purchasing it when available on Amazon Kindle and have since done so. In the nature of ensuring I share the love and complimentary goodies, Josh allowed me to give away my printed copy to someone, which I did at a Silverlight user group meeting just last night. I’m grateful Josh provided me with a printed copy and also grateful he encouraged me to give it as a prize.
The book is about 50-ish printed pages and is a quick read. It covers creating a simple and common game, Bubble Burst, using the MVVM pattern. The code is all WPF, but the concepts still apply to Silverlight development and Josh points out some areas where there are differences.
All of the code discussed in the book is available to download so that you can work with starting projects as you go throughout the book learning the pattern. Josh covers all the key topics of the pattern you would expect: ViewModel, View, Commands, etc. One of the things that Josh is good about is not being a zealot of the pattern. He’s quick to point out that when code belongs with the View and when he thinks it doesn’t.
When doing development I always think it is a great idea to have some solid references on your shelf. No matter where you are in your skill set, there will always be those times when you want to refer back to something you may have forgotten or perhaps get a different perspective on a specific way of doing things. For MVVM development, I think this is one such reference.
On a side note, Josh got a lot of crap for his initial chosen method of distribution (Lulu digital, which uses a DRM PDF). He quickly responded and offered a printable copy as well as put it on Amazon for Kindle distribution (which I bought and can read on my Kindle, my phone or my PC…note: phone and PC are in color too). There are a multitude of ways you can get the title all of which are listed at the AdvancedMVVM.com web site which also lists a table of contents for the book. If you are doing Silverlight or WPF development you should pick it up, read it and keep it handy. It’s not the only opinion, of course, but it is a great presentation of the pattern relevant to the development platform that I’ve seen.