Adoption problems with WPF

I was hav­ing an email con­ver­sa­tion with a friend on WPF yes­ter­day and he sug­gest­ed putting it into a blog post after I went on and on for a bit (sor­ry Raj!).

Hav­ing spent some time learn­ing Sil­verlight (which is a sub­set of WPF for the web, Microsoft’s equiv­a­lent of Flash) I have real­ly come to like the new pro­gram­ming mod­el in WPF and how eas­i­ly it allows you to do things that were sim­ply impos­si­ble to do in Win­Forms (ever tried to put a round­ed cor­ner to a rec­tan­gle any­one?).

To those not famil­iar with WPF, it’s pow­ered by Direc­tX so you get hard­ware accel­er­a­tion and can use fea­tures such as trans­paren­cy, gra­di­ents and trans­for­ma­tions. Its pro­gram­ming mod­el enables clear sep­a­ra­tion of the UI from busi­ness log­ics because you now have to build your UI using a declar­a­tive lan­guage – XAML (Exten­si­ble Appli­ca­tion Markup Language).

The event mod­el has also been revamped and it’s now pos­si­ble to ‘route’ an event so it orig­i­nates from one ele­ment but is raised by anoth­er. WPF sup­ports sev­er­al types of rout­ed events, but Sil­verlight only allows bub­bled events which cas­cades up the con­tain­ment hier­ar­chy from deeply nest­ed ele­ment to its con­tain­ers.

Why is Declarative UI better?

Whilst declar­a­tive UI is some­thing of a shock to the sys­tem to most of us (web devel­op­ers not includ­ed!) it actu­al­ly makes per­fect sense because it helps solve one of the biggest prob­lems in UI devel­op­ment – busi­ness log­ic embed­ded in UI.

A declar­a­tive UI makes it hard­er to write busi­ness log­ic into the UI because you’re writ­ing less code. How­ev­er, it’s not about sep­a­ra­tion of tiers, but sep­a­ra­tion of con­cerns, so when you find prob­lems there is a small­er blast radius! Which again, all comes down to loose cou­pling — the same thing peo­ple are try­ing to achieve with IoC and Depen­den­cy Inver­sion from a depen­den­cy point of view.

So all’s well with WPF and indus­try vet­er­ans are all rav­ing about it (there’s a num­ber of shows on Dot­NetRocks alone which cov­ers WPF and Declar­a­tive UI) so why is there still a dis­tinct lack of real-world apps out there? Besides the odd project on Code­Plex like Fam­i­ly Show and Scott Hanselman’s BabySmash, I haven’t found too many exam­ples out there (it’s a shame Pho­tol­ogy’s dead.. :-( )

Problems:

I think there are two main rea­sons why a lot of peo­ple are still not adopt­ing WPF, nei­ther has any­thing to do with the tech­nol­o­gy itself which is like a fan­cy new drug which makes you nev­er want to go back! And there are plen­ty of indus­try sup­port both in terms of third par­ty sup­port (well known UI con­trols pro­duc­ers like teleriks, infrag­is­tics already offer numer­ous UI pack­ages for WPF and Sil­verlight) and back­ing from the indus­try vet­er­ans.

1. it’s still fair­ly young

Hav­ing only made it into the core .Net plat­form since .Net 3.0 (nov 2006) it is still fair­ly new to most devel­op­ers con­sid­er­ing that most peo­ple are still hap­py using .Net 2.0 (I know this is def­i­nite­ly true in the banking/enterprise world!) which equates to:

  • a lack of exist­ing exper­tise in the field, mak­ing it hard for would-be adopters because it adds to the cost of adop­tion in time and expense regard­less of their strat­e­gy to acquire these exper­tise, i.e. new recruit vs. train­ing exist­ing staffs
  • an addi­tion­al risk with adopt­ing WPF because you have to first migrate your plat­form to .Net 3.0, which, should be min­i­mal because it’s real­ly just an add-on to the .Net 2.0 frame­work. But then again, “why fix what’s not bro­ken?”

2. it’s only a viable option for new devel­op­ments

Because WPF intro­duces a com­plete­ly new set of tech­nolo­gies and a new pro­gram­ming mod­el to boot, it’ll require sig­nif­i­cant time and effort to con­vert an exist­ing UI appli­ca­tion. This means WPF is only worth con­sid­er­ing for new devel­op­ments.

The future:

As with all things Microsoft, there’s a strong focus on enter­prise users and I’m sure their rep­re­sen­ta­tives would con­tin­ue to make a push for their part­ners to adopt WPF and dare I say once they decide to jump on board MS would have a prob­lem stop­ping them from com­ing back for more! Yup, WPF is that good!

With the .Net plat­form going strong as ever (men­tioned in 44% of devel­op­er jobs post­ed in the UK in the last 6 months), the uni­ver­sal adop­tion of WPF as the de fac­to stan­dard for devel­op­ing UI appli­ca­tion should only be a mat­ter of time. Giv­en the risk-adverse nature of large enter­pris­es (who, giv­en their size and finan­cial mus­cles, have more say on tech­nol­o­gy trends than any­one else), it’s no sur­prise to me that WPF has not real­ly caught on, but as more and more enter­pris­es jump on the WPF band­wag­on they’ll in turn increase the size of the tal­ent pool avail­able to oth­ers and real­ly set the ball rolling.

Further reading:

WindowsClient.Net

Prism: pat­terns & prac­tices Com­pos­ite Appli­ca­tion Guid­ance for WPF and Sil­verlight site