Desktop apps came before Web Apps. This is a no brainer, the internet came into existence way after Desktop applications, and the initial internet consisted only of web pages. Web apps came later.
The presentation of Desktop apps have a history of being rigid, boring yet functional, for the most part strongly resembling the operating system, they’re installed on.
I know WPF is not a new kid on the block, but it is imo one of the most brilliant and under rated offerings so far released by Microsoft.
In essence a lot of developers have simply boycotted WPF and still opt for traditional Windows forms, but if the tech is so much better, then why?
Why WPF is not getting the attention it deserves?
This is the short list of reasons why WPF has yet to really capture the hearts of MS developers and become the defacto way of building modern UI’s.
- WPF (XAML) and Silverlight were bundled at launch. Now I know Silverlight takes a lot of flack as being an epic failure. However consider the following. The internet presentation at the time had come from HTML 4, XHTML was the defacto way of coding, and everything was becoming web based. It was another golden era for browsers. Tons of new competition, and the W3C was finally the authority it was supposed to be all this time. Mobile application development was on the rise. Most of the front end web logic was being powered by Js. Just to be clear, this was before JQuery!
Everyone was questioning, do we really want to consider using this “messy” and “delinquent” scripting language to power the next generation of the web. Let’s call it “Web 3”. Let me remind you how fast technology changes, this is at the time when Active-X was still semi acceptable, and Flash was the cool kid on the block.
So in essence, Microsoft back at the drawing board said “Look guys, our desktop apps look dated, Active-X has no future and HTML+JS isn’t ideal” Putting their heads together – their brightest engineers brought us WPF and XAML – XAML a descriptive XML based language. WPF and XAML would be used to build stunning desktop applications, Windows phone applications, and this would spill over to the “Write Once Deploy Everywhere” Web, in the form of a plugin called Silverlight, which could be theoretically installed in all major browsers. Interestingly enough IE was supposed to support XAML OOB, completely replacing the need for any HTML or Js.
Sounded good in theory, however at the time not only Microsoft was at the drawing board. Elsewhere steps were being taking to improve upon the dated status quo. Many Js frameworks were on the rise, most noticeably JQuery. Google hard at work developing Android decided to harness the power of HTML for their “Write Once Deploy Everywhere” strategy. And HTML too was being challenged – HTML 5 was born. HTML 5 had 1 major mandate, to allow for responsive web design, to make it easier to cater for all screen sizes on any device. Getting inline for the myriads of devices to enter the market place.
A few years in, and Microsoft realised that raw HTML5 had taken the lead for presentation, and since JQuery, I guess a lot of developers found new love for Js. Many advocate Js. Silverlight was retired.
Microsoft never retired WPF or XAML, but since WPF was not widely used at the time, a lot of developers assumed it had been retired too.
- There was confusion if XAML was a competitor of HTML. A lot of developers simply don’t trust the longevity of XAML.
- Developers have learnt to embed web browser controls to do UI with. Thus truly harnessing write once, deploy all.
- Desktop applications are on the decline.
- Developers are familiar with Windows Form, and refuse to learn a new (and complex) WPF.
- The confusion between Visual Studio and the need for an additional tool called Blend. Most developers take 1 look at Blend, and think yeah – this looks like Flash. There is no way in hell I have the ability to learn this!
My Experience with my first WPF Application
I remember on 2 occasions I’ve opened up Blend before and indeed it did look complex. Both times I’ve gone back to Windows Forms just because I’ve had to get the job done quickly and no time to experiment. This time was different. I decided no matter what I would do what it takes to learn WPF.
What I found is that WPF was less complex than I imagined, and my app even has some animation effects and cool stuff.
It took me just 3 days to become familiar with Blend. I still find it a bit strange to have to use 2 IDE’s for 1 application, but really this is nothing to complain about.
So what do I really think about WPF?
What I’ve noticed before as a Win Forms developer is you develop much lower expectations for your user interface. You end up developing these formal business looking applications. The UI’s look boring, and you focus on the functionality.
When it comes time to develop a new screen, most of the design considerations are where you will place your components from the standard toolbox. – Welcome to Win Forms development! Ah the joys🙂
One thing I’ve noticed about WPF is that it sets you free. In a way it is a bit scary, but at the same time very exciting.
When I develop a new screen in WPF much more possibilities are flying around in my head. It’s exactly like developing for the web. Suddenly you can get your designs down to the pixel level (if you want). Create interesting buttons with rounded corners and gradients, however overs, etc. Have a list of items in a WrapPanel, like div floating in HTML.
Simply put you can really fine tune the design experience. You also get storyboards and animations – so pretty much everything you need at your finger tips to create a UI exactly as you want it, all you need is time and imagination.
C# in the background
What I really like about WPF is that I can continue using C#. Let me be clear, I’ve seen a good few languages, and nothing beats the elegance and power of C#.
The controls however have not just been lazily ported across from Windows Forms.
Take a Winforms Datagrid, typically you go to the DB -> ORM your data across and then convert this to a Datarow.
In WPF each row IS your ORM type. You don’t type cast it in our out.
So for example : client myClient = DataGrid.selectedItem AND NOT client myClient = getClientByID(DataGrid.selectedItem.Columns[“ID”]);
Things like this make working with WPF a breeze.
If you’re not working in WPF and still using Win Forms you’re missing out.
Go ahead, dive in and give it a try.