Better User and Developer Experiences – From Windows Forms to WPF with MVVM: Introduction

I frequently talk to people trying to decide, for a new project, between Windows Forms and Windows Presentation Foundation.  After spending time with WPF, I feel there is no reason to choose Windows Forms for new development.  WPF, when used correctly, is far superior, both in terms of user experience, but also developer productivity.

I feel that the confusion around choosing WPF really stems from a lack of understanding about WPF.  Even people on my own team have been overwhelmed trying to understand how the different pieces of WPF fit together, and how to apply the new concepts introduced with WPF effectively.  In order to address this, I’m going to break this down into a few simple pieces, and show the migration in terms of thought required to transition from being a good Windows Forms developer to an effective WPF developer.

Windows Presentation Foundation is huge.  Do not doubt it.  It is huge, both in terms of scope, but also in terms of the radically different approach it takes to developing user interfaces than other technologies.  Don’t let the scope frighten you, however – it is very well thought out, and very usable, once you understand some of the basic concepts.

In addition to the huge scope of WPF, new design patterns have evolved to take advantage of the new features introduced by this framework.  The most commonly referenced one, in terms of WPF, seems to be MVVM, or Model-View-ViewModel.  The Model-View-ViewModel pattern was inspired by some of the features in WPF, and seems perfectly fit for WPF, so many developers advocate it (with good reason) for use with WPF.

Again, don’t let this frighten or discourage you… MVVM isn’t about making WPF more difficult, it’s about making WPF usable in a quick, efficient manner.  Learning MVVM actually makes understanding WPF easier, not more difficult.

The issue here is that WPF is large, and the framework doesn’t force you into a single way of working.  There are lots of ways to work with WPF, including doing nearly the exact thing you’re used to with Windows Forms!  This is part of the power and flexibility of WPF, but also a trap to watch for and to avoid.  MVVM helps guide and force you to take advantage of WPF’s new features effectively, insulating you from common pitfalls and mistakes.

For this series, I’m going to start by showing a simple Windows Forms application – an RSS Feed Reader, and demonstrate converting it to WPF.  I’ll start with a strait conversion – and demonstrate how you can make WPF look and work exactly the same as you can with Windows Forms.  I’ll then explain, in details, some of the new ways of thinking that are pervasive within WPF, and show how this should change your way of thinking about user interfaces.

In order to do this, we’ll work with four separate projects – which include three completely different versions of the same application.  The goal here isn’t to use WPF to make the application “pretty” or “flashy”, rather, it’s to show how you can use WPF to make an application more developer friendly, including making it cleaner, more logical, easier to maintain, and more testable.

… Continued in Part 1, The Model …

About Reed
Reed Copsey, Jr. - http://www.reedcopsey.com - http://twitter.com/ReedCopsey

Comments

10 Responses to “Better User and Developer Experiences – From Windows Forms to WPF with MVVM: Introduction”
  1. Vicente says:

    I’m really looking forward to read these series of posts :)

  2. DavidS says:

    Hey Reed, great series of posts. I was wondering if you had the source code for these applications that I could download. If so could you point me in the right direction? TIA

  3. Kian Mayne says:

    After having some pretty negative experiences with poor tutorials that simply give directions, paragraph 2 was certainly encouraging

Trackbacks

Check out what others are saying about this post...
  1. [...] This post was mentioned on Twitter by Ian Randall and Reed Copsey, Jr., SiteMan. SiteMan said: RT @ReedCopsey: Blogging on moving from WinForms to #WPF with #MVVM in #csharp – http://bit.ly/4yLQ7K and Part 1http://bit.ly/5993B3 online [...]

    [WORDPRESS HASHCASH] The comment’s server IP (208.74.66.43) doesn’t match the comment’s URL host IP (74.112.128.10) and so is spam.

  2. [...] mentioned in the introduction that a new architectural pattern has emerged for Windows Presentation Foundation: [...]

  3. […] Posted by Reed on Friday, November 20, 2009 · 9 Comments  […]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!