WPF vs Windows Forms

Today I was at a DevDay in Athens, Greece with subject the 3 W of .NET 3 and 3.5. WPF, WCF and WWF.

First of all, I want to say that for one for time, it was just like reading glorious posts on the net about how easy stuff are with Microsoft technologies. Guys, business applications are not a paper for a university lesson. Programmers in companies should not be carried away by tricks that show of, but not give a resolve issues that enterprise developers must solve.

Based on that, once again WCF was great. Hell its not because of reasons discussed  here and here. In the WWF, a colleague of mine asked a very logical question, but there was no answer either. I don’t know whether those presenting the technologies don’t have a deep understanding of the technologies discussed or they purpose is to market them.

In the subject that I understand best, that is WPF, I really must say that based on what was presented, no one would migrate to the technology. The speaker made the usual mistake of basing his presentation on the usual wrong stuff, Graphic, Animation Fantastic UI and the so called developer – designer better cooperation. But when a member of the audience asked the logical question, of why should I migrate,  when all there are so huge differences and especially when a dedicated designer will be required still there was no clear answer to point out that true power of WPF.

So I will try to point out what are the overwhelming advantages of WPF and also point out some of the wrongs that I have found in the last six months.

Yes there is a tough learning curve, but the true power of WPF resides in the data binding mechanism and the way it shares resources across the application. On extra benefit that comes from the learning curve is that who learn how to decouple logic from UI. It’s not because of a pattern, but because of the data binding mechanism. Truly an application will last longer, when the UI can be changed without producing problems to the logic. Use the templates right and you can change a piece of UI code that reflects to the entire application. And don’t get me started about the usage of Control Templates.

Routed events are also great but the resource sharing is awesome. Just create a themed application in windows forms and compare the memory used by heavy brushes with a WPF themed application.

All the above comes with greatly improved performance, bonus from .NET 3.5 SP1.

My first problem with WPF and with Microsoft is the total disregard for Datasets and especially typed datasets. WPF will be on a client which if it is an enterprise application, it will require an application server. What better way to have related data transferred over the wire than from dataset? This is why I say that Microsoft has great ideas, but tends to forget the real needs of business. All examples are with simple objects which have set and get methods. But that is the simple way. That would be the solution for a university exercise because in real world you cant hit the application server continually, wcf or not.

Second problem with WPF is the Command mechanism that is used. Don’t get me wrong, the idea is great but why it must be static the Command instance? If I want to create the same form twice as non modal window, what will happen? It is not clear to me why they have chosen static for commands.

For the last six months I’ve been developing with colleagues a WPF application that can handle several modules not known at design time, and all these modules and the shell can must present themselves in various languages based on the installation. I really don’t know how some things could have been made with windows forms.

For me WPF and WCF are the most powerful add-ons in the .NET3 version and older. I just wish Microsoft would be a little more serious about the needs of true enterprise applications and not just glowingly showing little demos.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s