Introduction:

I’m going to keep this very factual. I’ve been developing Flash for the last 6 years and intend to carry on doing so, as a result I’ve learned to accept a lot of criticism and be open to review all things new, in effect I’m opening by saying I have not been “bought” as you will no doubt see in this article I aim to give an entirely balanced perspective, the politics interest me not, just the tech. With that in mind, I’ve been able to get very deep into WPF/E for the last week or so, I’ve always enjoyed dipping into a brand new tech and getting fully engrossed in it, so it was a nice experience to be given the opportunity (thanks). You may find me making a lot of comparisons to Flash, this is only natural for obvious reasons.

Ok let’s start with what it is. It’s a browser plug-in for Mac and PC browsers that displays graphics and animations written in XAML, an XML based markup language. To add interactivity and logic, right now you must use JavaScript, and you write that in a typically DHTML way with functions like wpfe.findName() being akin to document.getElementById(). At present the relationship between your markup and JavaScript is achieved by writing the names of javascript functions in your XAML event attributes, for example when an animation completes, or when the user rolls over an element. XAML is the one thing that links WPF/E (codename) with WPF (part of .NET3 and Windows Vista) at present.

The Technology:

Ok so I read online MXML looks like XAML. There’s quite a difference here. You can think of XAML more in the vein of SVG with SMIL and interactivity. It is not compiled into a binary, it is indexable in the page by Google if you link to it, or embed it directly in your XHTML page for example. So that leads to both problems and benefits when compared to SWF, it totally depends on the type of content you are creating. It can mean incredibly large files, something that zipping might help, it also means it can be easily generated by a server, and doesn’t then need to be compiled before it is viewed. It also makes things like frame based animation difficult, something that binary can do quite efficiently. So points on both sides there.

So that is the presentation layer. Now the logic. You use JavaScript. When I found this out my heart sank a little. Flash developers can be (and I am included here), complete snobs, since we’ve had a fairly decent language since AS2, with AS3 we have a language to envy, and JavaScript hasn’t really changed much over the years, it is stuck at about an ActionScript 0.9 level, in terms of how you have to go about programming with OO in mind, scope chain lookups and the list can go on. I’ve been lurking around the AJAX developer communities and I am sometimes in awe of how rudimentary the majority of the code is. I imagine there is a going to be a BIG sigh of relief when JavaScript 2.0 proliferates, and rightly so. Still having said this, developing with JavaScript wasn’t quite so bad, you can see some of my source later, there are thing you can do to organise yourself a little better, even if you don’t have real packages and so on.

Examples:

So here are some examples I’ve worked on this week. I’ve also worked up a small library of classes that are useful in not only WPF/E development, but also in JavasScript development in general, for example EventDispatcher, Delegate, and XmlHttpRequestHelper which turns the rather naff XMLHTTPRequest object which AJAX folk love, and makes it into something like LoadVars/XML in AS1 without the XML parsing abilities etc, you still can’t get progress out of it though, nonetheless it removes some headaches. I’ve included full source with all these examples.

http://richardleggett.co.uk/downloads/wpfe/Tests/Tests/

You’ll also notice that on that page I’ve included a couple of techniques that I’ve picked up over the week.

Conclusion:

This is the real tough one. How can a product that is not even yet 1.0 compete with a product that has been around for 10 years – they’d have to prise Flash from the developers’ cold dead hands on the most part. This is key when doing the inevitable and comparing it to Flash, just what is the hard sell that will make me use it over Flash right now – maybe nothing for a lot of people at least with v1. I do see a lot of potential in WPF/E, however, so I should explain this… When Nintendo released the DS and Wii, they had to compete in a world where Playstation and XBox owned all, they simply could not compete in graphical prowess and hardcore budgets, so they didn’t, they found a new market in terms of the price point and concentrated on their strengths, the Wii actually re-inventing gaming. So with that analogy in mind, you would be crazy to battle against Flash in the short-term, you need something more tangible…

It is crystal clear that MS are targeting AJAX developers, giving them the tools they want without them having to learn ActionScript or Flash, they are also targeting to some extent two other groups. Designers are key, the Blend and Design tools are being made with these people in mind, I think this is a very tough market to grab, but competition (and of course integration) between the tools of the various proprietors is to be welcomed. The final market is quite obviously people who are already using Windows Media Video, particularly live streaming (i.e. the *other* end of the online video market). These people traditionally use an embedded Windows Media Player in the HTML page which is pretty awful. I heard someone say that if WPF/E means they can make a nice video player for their content, the rest is a bonus.

It is always a time for predictions as we reach the end of a year. So for me 2007 will no doubt see the clash of several new web technologies, maybe the revival of some that have laid low (Java), but all in all this is best for people like you or me who are not afraid of learning something new and bolstering old skills. I’d also like to say goodbye to differentiating between whether something is made in AJAX or Flash, and even if something is a web app, RIA, or desktop application, separating these things into groups is done by people with legacy mind sets, and is a sure way to slow down the rate of advancement in the field of computing. I hope you find the examples and information presented here useful.