Symmetri Developer Blog

September 23, 2008

Silverlight vs Flex

General, Flash/Flex, Ajax, .NET/C# - By Shourov Bhattacharya

The term “Web 2.0″ can mean a lot of things to a lot of people, but one thing that most would agree on is that one part of the “Web 2.0″ revolution is the development of a new generation of applications known as “Rich Internet Applications” (RIAs). Loosely speaking, RIAs are web applications that do not behave like traditional web applications; they offer a user experience that is fast and interactive and hides the server/client post-and-response cycle from the user. The earliest prototypes of RIAs used client-side Javascript to manage change in parts of a traditional webpages without having to refresh the entire page; in time, this led to the development of what is now known as Ajax. From a different direction, many developers (including myself) began using Flash to build user interfaces that were visually rich but difficult to create and manage; as Flash did not natively support many of the activities needed for building interfaces, we were forced to build our own code to do even simple tasks such as a building forms and managing common components.

The past year and a half have seen a quantum leap in RIA development. Adobe has released Flex, a new development environment that synthesizes Flash/AS3 with HTML-like front-end code to build RIAs that run within Flash Player 9. Microsoft has released Silverlight, a RIA platform based on .NET which allows applications to run within the browser using the Silverlight plugin. Both of these seek to leverage off existing technologies: Actionscript 3 for Adobe, C#/.NET framework for Microsoft; both allow the developer to quickly create and deploy visually impressive and functional web applications that would have taken much longer the old way.

So which way to go - Flex or Silverlight? I am facing that decision for a new project that involves developing two web applications: a smart client application that needs to run as either a disconnected or connected client, store data locally and upload to a server; and a server-based web application that creates reports based on that aggregated data and makes them accessible on the Web. I want to build an RIA for both - I have ruled out doing in the traditional way (desktop app/web 1.0 application).

There are plenty of forums and articles out there that compare Flex and Silverlight; as usual when developers discuss their choice of technology, much of the discussion can get quite heated and parochial. It is hard, sometimes, to judge things on an objective basis when people’s opinions are so often coloured by their prejudices about Adobe and Microsoft. As a developer I can honestly say that I do not share those prejudices; I have spent almost exactly equal time developing in Flash/AS3 and .NET over the past two or three years, and I am equally comfortable with the technology and support tools for both.

Here is my attempt at weighing up the pros and cons for each technology (although I am thinking within the context of my new project, I believe the issues are general enough):

Adobe Flex:

Pros: more mature technology with a larger developer community (as of now) which means better support; leverages off existing AS3 knowledge; can use Flash animations; Adobe AIR makes it easy to build RIAs that live both on and off the web; Flash Player 9 available on 97%+ client machines; both development process and the deployed application run truly platform-independently; better charting capability for reports?

Cons: Flex Builder 3 IDE costs about $500; Flash Player 9 still has some quirks (!); harder to talk to existing server apps in ASP.NET

Microsoft Silverlight:

Pros: leverage off existing C#/.NET domain knowledge; VS2008 is a superior IDE (IMO) compared to Eclipse based IDE of Flex Builder; integrate seamlessly with traditional .NET 3.5 web apps; can launch from local filesystem and run as a desktop app; Silverlight plugin exists for all browsers; C# is more strongly typed and has some features (e.g. generics) that AS3 still lacks

Cons: need VS2008 license $800+; cannot develop on Mac OSX (as far as I can see); Silverlight plugin is not as widely installed as Flash Player 9; newer technology that is just out of Beta and therefore has less of a developer community and possibly more bugs and unresolved issues

I have decided to use Flex. I am more comfortable with the Flash Player as a platform right now than I am with the Silverlight plugin, and I am also conscious of how hard it might be to find good examples and support when developing with Silverlight; in the context of a commercial project, those inevitable bottlenecks can make or break timelines and budgets. Also, I like the flexibility of developing in Mac OSX as well as Windows, and I cannot do that with Silverlight; and I think that the Adobe AIR provides as excellent solution to my problem of creating a disconnected desktop client that can also run within a browser (although I know that Silverlight can do that as well, deployment seems trickier and it is not as well documented at this stage as Adobe AIR).

These are exciting times for web developers. Both of these new technologies are impressive in their own right, and there isn’t that much between them. I suspect the market will decide on a combination of both, and neither Adobe nor Microsoft will find it easy to dominate the RIA space. Ultimately the competition will hopefully benefit all of us. I am looking forward to getting stuck into proper RIA development with Flex.

Microsoft Silverlight showcase: http://silverlight.net/Showcase/
Adobe Flex showcase: http://flex.org/showcase/

November 7, 2007

parentElement and parentNode

Ajax, Javascript - By Shourov Bhattacharya

I’ve been using parentElement to work my way up the DOM in Javascript, but it completely slipped my mind until recently that it doesn’t work in Firefox. The reason is that parentElement is one of those non-standard little add-ons that Microsoft so love to give us when releasing browser support. The better alternative is parentNode, which is part of the W3C standard.   

Get free blog up and running in minutes with Blogsome
Theme designed by Janis Joseph