Is WPF an Ungodly Jumble of Concepts?

I’ve been messing around with WPF for a little while, and every time I revisit it I feel as if the idea was pretty good, but there were simple too many chefs in the kitchen when it was made, and subsequently we are left with this “thing” that seems to have a lot to offer, but somehow rarely delivers. I see a bunch of “conceptual applications” written using WPF, but very few successful commercial applications rely on the framework. The ones that do, sometimes struggle to run smoothly and usually a range of graphical issues. I think the reason is that there are simply too many ways to skin a cat in WPF.

Take a TreeView for example. Because there are so many ways to customize the control, it is extremely hard to find the “right way”. The idea that you “style” your control makes sense – right – just like CSS,  you define how your control should look and feel. Ah.. but naturally, nothing is as easy as it seems. When you select an item in the list, the default implementation draws a horrible looking flat blue box behind everything. Guess what people try to change the color? Alter the “Background Color” property! Does that work? No because the property is not the “Background” it is “Highlighted”

<SolidColorBrush Color="Yellow" x:Key="{x:Static SystemColors.HighlightBrushKey}"/>

People look at the behavior of the control, and it appears that the background color is changing and therefore thats what they try to change. It doesn’t work obviously, and if you are like me, you get frustrated. There might be some academic logic behind doing it the way they’ve designed it, but a great API must also cater to the expectations of the user. In this case a multitude of developers who ran into this problem (naturally, we will never know how many people ran into it – once one solution is posted, the number of posts drop), so clearly the API is – if not broken, then cracked here. But to make matters even worse, you don’t need to populate the tree with traditional content. You can populate it with pretty much anything, buttons, images, combo-boxes and even your own custom controls that also handle mouse-over events.

There are also some evidence of poor discipline in naming convention. A Border has a “CornerRadius”, while a Rectangle has a “RadiusX/RadiusY”. The border is a container element, but it does not clip the content to the rounded corners!? Sometimes the background is a “color” sometimes it is a “brush”, so even though the values for “Fill” and “Background” are the same (say “Blue”), and even though they perform the same action (determine how stuff “behind” looks), they are not the same at all.

A bunch of issues are not revealed at compile-time. As a developer you need your errors to be caught as fast as possible, yet happens quite often that things just don’t work (Brush vs. Color for example) and there is no way of knowing until you run the app.

Add to that the confusing idea that Silverlight and WPF controls are not interchangable. .NET Compact Framework is a well defined subset of .NET, while Silverlight is not really a subset of WPF. Well – it might actually be a subset in terms of functionality, but Silverlight controls don’t, natively, work with WPF (this is either fixed, or in progress to be fixed – but still weird that it was not made like that from the beginning).

Take a look at the WPF samples, and what you usually find is awful copies of OSX concepts mixed with examples of effects that date back to when a Java reflective pool was considered cool. A fair number of samples exhibit a horrid use of resources. Even if you DO have a GPU, you still need to know what you are doing, and since WPF lends itself to creating semi-transparent-dropshadowed-reflective images, people will pepper their apps with those functions – just because you can. It’s like Wordart for programmers.

I am not saying that WPF makes it impossible, or even difficult to get your app going. I am saying that the learning curve is unnecessarily steep. Anyhow. Thankfully we have some people who know WPF better than I do, and most of them disagree with me, but that should not keep me from speaking my mind about this topic.


Author: prescienta

Prescientas ruler

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s