The big cutover

Dear Diary,

Last week I said that there’s a “Great Refactoring” on every project — and I just committed ours to SVN.  For what I thought were good reasons at the time, we started out with pure WinForms for our presentation layer.  Starting today, we’re mixing in WPF for some of the little data entry screens.  I’m a complete newbie to WPF, so some of the learning curve hurt.  Anyway, here’s my original reasons for using WinForms and other thoughts.

  • Risk.  I knew we could deliver in WinForms, and I didn’t want to stop to ramp up with WPF.  I still think that was valid, but we’re going to use WPF so simply that I don’t think it would matter much.
  • I was initially hesitant to try WPF because the scuttlebutt was that WPF was hard or impossible to test.  So far I’ve been able to adapt my infrastructure and approach to testing WinForms and apply it almost unchanged to WPF.  All I really had to do was just put a little adapter code in my test automation for the different set of controls.  WPF doesn’t really do anything to *help* you do automated testing, but it doesn’t hamper testing (whatever that Automation API is supposed to be for, it isn’t all that useful for testing).  Simulating events with the new RoutedEvent stuff was pure klooge, otherwise it’s been fine.
  • The rendering performance is much, much better than the equivalent screens were in WinForms.  Even when we’re just hosting WPF inside of a WinForms Panel the performance is still better.
  • We’re doing some dynamic layout of screens with a little home cooked DSL.  The WPF layout controls are head and shoulders better than the WinForms analogues.  This was actually the main reason we switched, truth be told.
  • That whole “do Separated Presentation to protect yourself from changes in Presentation technology” bromide?  Yep.  The cutover really wasn’t that bad because we had very little code that actually touched the WinForms classes.  The Fluent Interface stuff we use to drive the screens payed off in a big way here.
  • I thought we could reuse a lot of WinForms layout code from an earlier version of the system.  As usual, the old code is of dubious usefulness.  From this point on I’m only using the old code as reference.

Anyway, I’m alive.  If that’s the worst thing that happens in our code, I’m a happy camper.  Back to building real code now.

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.