Jun 14, 2011

Beginning WPF: WPF & MVVM in One Weekend

Pluralsight to the Rescue

In a previous post on learning WCF, I mentioned how impressed I was with the Pluralsight training video and how next time I had to learn a technology I would consider a subscription in lieu of buying a book. Well good to my word, I plunked down $29 for an auto-renewing one-month membership, cancelable at any time. I must say I think it was money well spent and I still have most of the month left to explore more topics. I started with the course on WPF (Windows Presentation Foundation). While I'm sure you can get a lot of this information for free from various sites on the net (Channel 9 and  WindowsClient.Net come to mind), the high-quality and organization of the Pluralsight videos saved me a lot of time and effort. You can make that decision for yourself because you can browse the course catalog and see how each lesson is organized. You can also watch for free for ten days or 200 minutes, whichever comes first. My 200 minutes lasted, well about 201 minutes, but it was enough that I felt extremely confident signing up for a month.  Courses like the one on WPF are broken down much like a book with sections, chapters and topics. The WPF training I watched was split over three "sections": WPF Fundamentals, WPF Advanced Topics and What's new WPF 4.0.  The Fundamentals course had nine chapters, and each chapter had over a dozen topics. The individual topic videos run from under a minute to usually no more than 15 minutes. A chapter typically ranges from 15 minutes to 90 minutes. The Entire Fundamentals course takes just under 7 hours to complete.

Production Values

The quality of the video is excellent and the instructor Ian Griffiths was clear and to the point. The only downside was his voice sounded like it had been artificially accelerated to speed up the videos. That may not be true, but that's how it sounded and it was a little annoying.  I eventually got used to it and I suppose in the long run it was a benefit in that it saved me time. Ian has other videos on Pluralsight where his voice is delightful to listen to (if you like those British accents).  (Also I found that setting the volume on the Silverlight player to about 50% helps a lot, on my system the full volume setting sent a lot of distortion into my sound card).

Ready to Code in MVVM

I felt like I not only got a good overview and understanding of WPF and XAML, but I got enough detail that I was willing to cut my apron strings to WinForms and start my current project in WPF. The current design pattern of choice for WPF appears to be a customized version of Martin Fowler's Presentation Model. I figured while I was learning WPF I should start with this idiom. Pluralsight also has a nice course on MVVM. However, I found the implementation details presented in the course less than ideal. It's a good course for getting an overview of the pattern but I found Todd Miranda's 47 minute MVVM screencast on WindowsClient.net a better model for building my application.

I started on Saturday and now it's Tuesday morning and I have the first several user controls done and data-bound to the ViewModel and the main application screen is starting to come together. I know there's still a lot to learn but after one weekend I do feel that I can accomplish the task at hand. I expect it to take me significantly longer than if I had done it in WinForms but I also suspect the final application will be much easier to maintain. The separation of concerns that MVVM provides is very appealing. The only thing I'm a little concerned about is the implied fragility of refactoring. It appears to me all the data binding is done with reflection on strings from the XAML. I 'm pretty sure if I rename a property it will break my XAML, but maybe ReSharper will help out here.

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.