CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

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.


Comments

Mike Jones said:

Wow, WPF has been out almost 2 years, even more if you include the betas.  Makes you wonder about ALT.NET's (your) rhetoric:

"...while keeping an eye out for a better way."  Ignorance of WPF doesn't seem like keeping an eye out.

"You reach outside the mainstream to adopt the best of any community."  If WinForms is the mainstream, in .NET client applications, WTF?

"You're not content with the status quo." If WinForms is the status quo in .NET client applications, WTF?

Is ALT.NET simply for evaluating others and not yourself?

# March 18, 2008 2:21 PM

Carlton said:

This should be interesting....

# March 18, 2008 2:31 PM

Chad Myers said:

@Mike: What would you consider mainstream then?

For __thick client .NET apps__, WinForms is most definitely the mainstream. WPF is catching on, but I don't see a lot of WPF apps out there yet (including and especially from Microsoft themselves).

The Windows Live stuff is from MSFT and Windows Live Writer appears to be the only managed (.NET) app and is all WinForms.

If WPF is mainstream, why didn't Microsoft use WPF for WLW? It's a new product, so it seems reasonable they would dogfood it.

# March 18, 2008 3:05 PM

Wah wah waaaah said:

Rut Row Raggy

# March 18, 2008 3:14 PM

Jeremy D. Miller said:

What can I say Mike?  The best blog posts are often about the mistakes we make.  Besides, WPF wasn't interesting to me until we started trying to do dynamic layout stuff on this project.

# March 18, 2008 3:17 PM

Bryan Reynolds said:

Can you point me to information about best pratices with WPF?  

Bryan

# March 18, 2008 4:09 PM

Mike Jones said:

"...interesting to me until...", that just seems the complete opposite of ALT.NET and simply makes your complaints about EF unfounded because those devs could simply say the same thing.  "...until we started trying to do dynamic layout", seems like a tool crutch; and doesn't smell ALT.NET to me either.

# March 18, 2008 4:50 PM

Mike Jones said:

@Mike: What would you consider mainstream then?

Not really the point, the point was this leader of ALT.NET doesn't even follow the same basic philosophy that he's so quick to use to judge other people and tools.  If he's quick to dismiss himself he should be quick to dismiss others for doing the same thing.

# March 18, 2008 4:58 PM

Mike Suarez said:

@Bryan: keep an eye on codebetter.com/.../prism-ri-first-drop.aspx

@Jeremy: I email u a couple of days ago with a basic q on how to open a WPF window to test it. Anyways now I'm using White.

But still, I wonder how are you opening a WPF window for testing: by running the App or is it possible to run a stand alone window?

# March 18, 2008 5:21 PM

Jeremy D. Miller said:

@Mike Jones,

Give me a break dude.  You're basically criticizing me for not learning the details of a specific technology that I didn't have any use for until this past week.  I *knew* what WPF was, but it wasn't germane to anything I was doing.  

Besides, it's just the presentation layer.  WinForms isn't perfect, but it hasn't been the painpoint over the last 2 years for me.

# March 18, 2008 5:33 PM

Rob said:

Cool stuff.  Looking forward to hearing more about your experiences developing with WPF; doing agile, tdd, yada yada.  If you have any WPF questions along the way, don't hesitate to contact me.  I've learned a great deal from you, so I'm happy to give back in any way I can.  You know how to reach me ;) PEACE Brotha'

# March 18, 2008 5:56 PM

Oran said:

Wow Mike Jones, you sound bitter!  A few years from now when Jeremy finally finds some limited usefulness for Windows Workflow, are you gonna be back here beating him over the head for not using it sooner?

It's not like Alt .NET is an ultra-conservative orthodox religion and Jeremy is its high priest... lighten up.

# March 18, 2008 5:57 PM

Chad Myers said:

@Mike Jones:

That's a false dichotomy. Jeremy knew OF and enough ABOUT WPF to know that he didn't want to head down that road right off the bat.

The EF team, OTOH, seemed to be totally surprised by the concept of 'Persistence Ignorance' which had existed for several years.

You'd expect someone starting a new Thickclient app to be aware of WPF (which Jeremy was), likewise you'd expect the EF team to be aware of persistence ignorance (which they apparently weren't).

# March 18, 2008 7:04 PM

Wendy said:

Hope you have fun!

I had worked in winforms for so many years and although I found the learning curve on xaml a little challenging, using patterns from winforms was simple (even better). I really love wpf and hope it spreads through the community even more :)

How's it going in Austin? Do you miss NY yet?

# March 18, 2008 8:30 PM

Scott Bellware said:

When did ALT.NET become all about adopting the latest Microsoft stuff as quickly as possible?  I guess I missed the cut-over from the expectation of pragmatic development and adoption to the Tech Ed school of software adoption imperative.  Shame on you Jeremy for countermanding the new and revised ALT.NET approach!

# March 19, 2008 12:51 AM

home automation said:

Pingback from  home automation

# March 19, 2008 10:07 PM

Charlie said:

@Mike you need to see a tree surgeon to get that stick pulled out of your a*se.

# March 25, 2008 2:02 PM

Dabbler » Blog Archive » Winforms to WPF said:

Pingback from  Dabbler  » Blog Archive   » Winforms to WPF

# March 30, 2008 9:01 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

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 previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP