Flex\Flash\AIR vs Silverlight: conquering the land of RIA

We live in interesting times. Rich UI web application development with next generation user interfaces are in increasing demand, and so the great RIA war rages on, with Adobe and Microsoft as major players competing for market prevalence. The competition can be beneficial, as it forces both companies to deliver new versions of their products more quickly, and with increasingly impressive features. This competition, however, also has downsides. It forces companies to rush and sometimes deliver features in raw and incomplete form. They often focus more on new features than on polishing the existing ones. As a result, the changes occur so rapidly that keeping up with the latest developments is nearly impossible. That is why new articles comparing and contrasting the current state of their systems are always useful. Indeed, many such articles have been written before (for example this one or this one), but they quickly become outdated and occasionally fail to include an important topic.

Functionality

Adobe has been on RIA market longer, so it's not surprising that Flex\Flash\AIR still offers much more impressive set of features. Let's just cover the features where the difference between both frameworks exists and may be important in choice of target platform.

Supported operating systems. AIR is a clear winner here, with Silverlight not supporting Linux on any browser (and nobody's sure it ever will). As for mobile devices, perspectives are not very bright for both: Microsoft promised to support Silverlight on upcoming Windows Mobile 7, and Flash is still not supported on iPhone and BlackBerry.

Silverlight functionality limitations are well-known and could easily surprise any newcomer. Lack of printing support, no support for right mouse click, limited keyboard input in full-screen mode. It's surprising how all these obvious shortcomings managed to survive till Silverlight 3, but Silverlight 4 finally promises to overcome them.

Features for working with audio and video
are again richer for Adobe technologies, but Silverlight 4 promises to cover this breach by adding support for local video recording and enhancing output protection for audio/video streams.

Styling\templating. Here Silverlight wins: Flex styling is based on inheritance and commonly regarded as inflexible. Silverlight, however, has an ability to override current template completely, which is much more powerful concept, but the price is a lot of excessive information in your XAML, making it not easily readable.

Out-of-browser capabilities. Adobe is way ahead, AIR is a full-scale cross-platform runtime environment, and it has a number of nice built-in advanced features like integrated browser and support for local SQLLite database with automated client\server data synchronization. Silverlight tries to move in this direction too, Silverlight 3 has out-of-browser mode, and Silverlight 4 adds much tighter integration with HTML and advanced support for trusted application.

Ease of development

It's not only functionality that matters. Here we're trying to cover things that not visible to end-user eye, but ones that could greatly effect the speed of development.

Programming language. One of the strongest points of Silverlight is that the underlying language is the same good old C# or VB.Net, so you may use the same well-known language both server- and client-side. But it doesn't mean code reuse is very easy in Silverlight: there are ways, but they are not intuitive and require some additional work. The problem gets even worse if you try to multitarget user interface both for WPF and Silverlight: both frameworks have surprisingly large number of differences, although such kind of multitargeting is still possible.

IDEs. Adobe Flex Builder isn't as polished and feature-rich as Microsoft Visual Studio, although Flex community has a number of other helpful tools (like FDT and De MonsterDebugger) that may make development more effective.

Client-server communication frameworks
. WebOrb is a breakthrough technology here, a multi-platform suite that can streamline client-server communication needs, make it transparent and purely object-oriented. WebOrb works both with Silverlight and Flex clients, but Adobe and Microsoft were quick to present their own alternatives, Adobe LifeCycle Data Services ES and Microsoft WCF Ria Services, and both technologies look very promising.

Third party frameworks and components. Ria technologies are much in demand, so there's no shortage of third-party software for both platforms.

Behavior injection. A minor thing, but one that could greatly improve your code by making the similar UI behavior patterns reusable. Microsoft did a great job of introducing this concept as attached behaviors, although only in Silverlight 4 they will become bindable. Some Flex developers are working in this direction too, but that work is far from polished and widely-known.

Validation. Here I can only refer to an excellent article by Alex van Beek. I completely agree with this article's conclusions: Flex validation is much easier to implement, but Silverlight validation is more business logics-oriented and much better suits MVVM scenario.

Performance

Performance is an important thing, as it greatly affects overall user experience. It becomes even more important when you're dealing with rich internet applications, which are traditionally not as performant as their non-browser-based counterparts.

Computational performance. Silverlight is a clear winner in a field of pure computational performance, and Flex has no built-in support for multithreading, which further complicates the situation.

Graphical performance. No clear answer here, just some performance benchmarks. The common opinion is that both platforms are comparable in this field.

Profiling tools. Here Silverlight may win in comparison to Flex in a very near future, although till most recent times Silverlight had no profiling API at all, and profiling tools were limited to SilverProfiler, whose abilities were very limited, and Microsoft's own performance analyzing tools (xperf), which weren't very informative. The situation has changed with a release of EQATEC Profiler 3.1 and may become increasingly better with the release of Silverlight 4 beta. Flex has its own profiling tool (Flexbuilder), but it's far from perfect, and it seems that there's no alternative at all for now.

Conclusions

There's no simple answer as to which technology to choose. Flex\AIR still seems to be a better option when rich out-of-browser functionality is required, and if your program must run on Linux you don't have much choice. But Silverlight is progressing very fast and promises better integration with other Microsoft technologies, which is not perfect now, but may and will increase in time. As a result, most likely both technologies will co-exist and thrive, so it's not about controlling the market, it's about getting a larger share in new and very perspective field of this market. The future for both Silverlight and Flex seems bright indeed - because this war is not about fighting for the same well-known piece of land, it's about conquering a new and uncharted continent of next generation applications, and as with England and Spain during the Age of Discovery, both Adobe and Microsoft has much ground to conquer.