 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
|
 |
 |
 |
|
 |
|
|
 |
|
 |
 |
 |
| |
|
|
 |
 |
 |
|
|
| |
|
An abundance
of riches |
 |
Should you be building your Rich Internet Applications for Flash, Silverlight or JavaFX? Tim Anderson assesses your options. |
|
|
The browser wars are back, as Microsoft’s Internet Explorer 8 battles for market share with Mozilla Firefox and newcomer Google Chrome. Today though it is not just the browser which is the focus of attention, but the plug-ins that run within it. Multimedia add-ons like Adobe Flash and Microsoft Silverlight are now capable of running complete applications, enabling developers to avoid the hassles of browser variations while also getting the benefit of additional features. The user’s perspective remains the same: navigate to the URL, and it just works.
The concept of the Rich Internet Application (RIA) was originally pioneered by Macromedia (now part of Adobe) some ten years ago in an effort to persuade developers that Flash was not just for adding multimedia pizzazz to Web pages. A key point at the time was that a Flash application enables interaction within a single page, whereas the browser model tends to invoke a new page every time the content changes. The rise of AJAX (Asynchronous JavaScript and XML) along with rich JavaScript libraries means that assumption is no longer valid since developers can create interactive pages by programming the browser DOM (Document Object Model) and retrieving data in the background, but using a plug-in still has advantages.
It is also possible to create hybrid applications, using the browser for some elements and the plug-in for others, and in practice this is a common approach. All the plug-ins enable easy two-way communication between the plug-in application and the Web page, so that for example code in the plug-in can update the page content, and script running in the browser can call into the plug-in application.
However Adobe no longer has this space all to itself. In 2005, Microsoft announced Windows Presentation Foundation/Everywhere (WPF/E), later renamed
Sun fights back
In the early days of the Web browser, Java was almost the only choice (other than HTML) for browser-hosted applets. Take up was limited, thanks to the heavyweight Java runtime, the complexities of the Swing layout mechanism, and the lack of multimedia support, giving an opportunity for Flash.
JavaFX is Sun’s attempt to win back a share of that market. JavaFX is a scripting language that runs on top of Java, so it depends on the full Java runtime and is a larger download than Flash or Silverlight. It simplifies layout and includes Flash-like features such as a timeline and motion paths. Multimedia is supported, but JavaFX relies more on the codecs that happen to be installed on the underlying operating system, making this less predictable for developers. It does have native support for On2’s VP6 decoder.
The reach of JavaFX falls somewhere between Flash and Silverlight. Mac and Windows are supported, but not yet Linux or Solaris, though this is promised. JavaFX is also available for mobile devices, though most users will be dependent on device manufacturers and mobile operators to make this available, which is an uncertain process.
The primary development tool for JavaFX is Sun’s IDE for Java, namely Netbeans. There are no dedicated designer-oriented tools but there are plug-ins for Adobe Illustrator CS3 and Adobe Photoshop CS3 which let you create visual assets in these applications and export them.
The biggest benefit of JavaFX is that developers can also code in Java, and have access to the full range of Java libraries subject only to the security restrictions imposed by running in the browser. The performance of JavaFX code is generally excellent, though start-up time may be slower than that for Flash or Silverlight which are more lightweight.
The evolution of JavaFX has been rapid and in some respects it shows signs of haste. It has the same kind of relationship to the Java platform that Silverlight has to the .NET platform. While it is attractive to Java developers, it is unlikely to win many migrants from the Adobe or Microsoft alternatives. Silverlight, which lets developers run a subset of the full Windows Presentation Foundation within the browser, cross-platform on Mac and Windows, and supported by the .NET runtime for executing languages such as C# and Visual Basic. The pace of Silverlight development has been impressive, and in March 2009 Microsoft announced version 3.0 which offers a range of new features and improved tools.
In the meantime, Sun has been trying to re-invigorate interest in Java within the browser with its JavaFX technology (see panel opposite for further details). Mozilla and Google by contrast are championing what is sometimes called the ‘Open Web’ which avoids proprietary plug-ins in favour of improved browser standards, observing that much of what developers want to do with Flash or Silverlight can also be done with the browser alone.
If you have a project for which an RIA is appropriate, how do you choose between these platforms? Despite their similarities, each has different strengths and its own set of tools and libraries.
Developing with Flash
The core of the Flash platform is a client runtime, the Flash Player, which is currently at version 10 and runs on Windows, Mac OS X v10.4 or higher (PowerPC or Intel), Linux and Solaris. It supports the major Web browsers, namely Internet Explorer, Safari, Firefox, Opera, and works unofficially with Google Chrome.
Adobe offers two development environments for Flash, one aimed at designers and the other at developers. The Flash IDE is part of Adobe’s Creative Suite 4 (CS4) and is ideal for creating graphical effects and animations. Flash is also deeply integrated with other CS4 products, many of which have an option to export to SWF (the Flash native format) or SWC, which is similar but represents a Flash component.
Developers generally prefer a more code-centric approach, and in order to provide this Adobe created Flex and MXML. Flex is the brand name, presumably a contraction of ‘Flash’ and ‘XML’, while MXML is an XML language for defining a Flash layout. You can also bind components to data within MXML. Program code is written in ActionScript 3.0, the native language of Flash, and this gets just-in-time compiled at runtime for fast performance, though it does not always match the performance of Silverlight or JavaFX.
Although based on JavaScript, ActionScript is a fully object-oriented language that is in some ways closer to Java or C# while retaining JavaScript’s dynamic features. This makes it an easy transition for Java or .NET developers. Adobe also has a product in preparation, code-named Alchemy, which converts C or C++ code to ActionScript.
The Flex SDK is run as an open source project by Adobe and is free to download and use. The official Flex IDE is a commercial product called FlexBuilder, built on Eclipse, and includes a simple GUI designer as well as code editing features.
Interoperability between Flex and the more designer-centric CS4 is strong. Flex can make full use of SWC components, and a new feature of the forthcoming Flex 4.0 is support for an additional vector graphics format, FXG, which enables another level of interoperability between Flex and applications such as Adobe Illustrator.

Developing an application with Adobe FlexBuilder 3.0.
Another forthcoming product is Flash Catalyst, which uses FXG. This lets you take a static piece of artwork exported from PhotoShop or Illustrator and start converting it into a GUI application by specifying parts of the artwork as buttons or lists, defining states and adding dynamic effects. Designers can then export this for developers to incorporate into a Flex application.
Flex applications can access data in several ways. Built-in libraries support data delivered as plain XML, accessed from any URL. There is also support for SOAP, an XML standard for invoking remote APIs. You can import a WSDL file, which defines a SOAP API, and have FlexBuilder generate classes for using the library. Adobe also offers JSON (JavaScript Object Notation) support via a downloadable library.
Finally, Flex can make use of Adobe’s efficient binary format, called AMF (Action Message Format), to call remote objects. These are typically exposed by a server library called LiveCycle Enterprise Services, which runs on a Java application server and integrates with existing Java applications on the server.
Deploying to AIR
Adobe AIR is a desktop runtime that incorporates several existing runtimes. These are the Flash runtime, the open source WebKit HTML rendering engine, and the open source SQLite database engine. AIR enables developers to take an application built with HTML, Flash or Flex and deploy it as a desktop application.
AIR applications have a limited ability to interact with the local machine. They have full access to the file system, with the same permissions as the user, can be a target for drag-and-drop actions, and can install into the notification area or equivalent where they run in the background and can show user alerts. There is no supported way to execute local applications or libraries. On installation, AIR applications request full permissions from the user and although Adobe has included some restrictions, they should be considered similar to other desktop applications from a security perspective, unlike Flash applications which are sandboxed by the browser.
Flash and Flex have lots of momentum and community support today, thanks to Adobe’s success in deploying the runtime. According to the statistical site riastats.com, Flash 9 or 10 is present on over 95 per cent of browsers. Adobe is working to extend this to mobile devices, though inevitably progress is slow and the runtimes less capable. Apple has yet to support Flash on the popular iPhone. Adobe is also successfully promoting Flash as a video client, which benefits application developers by increasing the runtime deployment.
Developing with Silverlight
Silverlight is currently at version 2.0, with version 3.0 promised by the end of 2009. The runtime works on Windows and Intel Mac, and an open source version called Moonlight, based on Mono, adds Linux support, though its development lags behind that of Microsoft’s offering. Silverlight supports major browsers including Internet Explorer, Firefox, Safari, and Google Chrome. Opera is not yet fully supported though this is in preparation.
Contrary to a common misunderstanding, Silverlight has no dependency on the full .NET runtime. Rather, it is an isolated browser plug-in, which includes only those parts of .NET that are relevant. Although deployment of the runtime lags a long way behind that of Flash, this is mitigated by a generally smooth install experience when users without Silverlight try to run your application - provided, of course, that the operating system and browser is compatible. The mobile story is less encouraging, and while Microsoft certainly intends to deliver a device runtime, nothing has yet been announced.
Technically, there are two kinds of code that make up a Silverlight application. Pages are defined in XAML, the same XML language used in the full Windows Presentation Foundation on Windows. XAML is more than just a layout language; it is an extensible declarative language that is in some respects more powerful than Adobe’s MXML. This is partly because Silverlight was designed from the start to render XAML, whereas MXML was created after the SWF format was established.
The other aspect of Silverlight is its .NET runtime, which like its big brother supports just-in-time compilation. Performance of the code seems generally excellent, reflecting the maturity of Microsoft’s runtime. Since it executes .NET IL (Intermediate Language), the programmer can write in C#, Visual Basic, or any .NET language. Dynamic language enthusiasts can use the .NET version of Python or Ruby, for example. The programming model is somewhat similar to that of ASP.NET, with XAML pages linked to a ‘code-behind’ file that contains the program code.

A demo application that uses Infragistics NetAdvantage controls in Silverlight.
There are two primary development tools for Silverlight. The first is Visual Studio. The Silverlight tools are an add-on for Visual Studio 2008, and will be fully integrated in the forthcoming Visual Studio 2010. The Visual Studio 2008 tools are fine for code but disappointing for XAML as there is no visual designer. You write XAML code and can check its appearance in a read-only preview pane. This limitation is removed in Visual Studio 2010.
The other Silverlight tool is Expression Blend, aimed at designers. A key feature is that both Visual Studio and Expression use XAML, which in theory allows round-tripping of project files between the two, though some users have reported compatibility issues. Blend is an advanced design tool, though it does not compare favourably with Adobe’s more mature Creative Suite. Another problem is that many designers work on the Apple Mac, and Expression runs only on Windows.
Microsoft’s Expression Blend 3, announced at the Mix conference in Spring 2009, has several promising new features. One crucial enhancement is import from Photoshop and Illustrator with full layer support, enabling designers to work in their preferred tools. Behaviors will let designers add interactivity without needing to know code. There is also a new prototyping tool called SketchFlow which lets designers export design ideas and receive comments.
Another interesting announcement at Mix was Silverlight 3, including the ability to run Silverlight applications out of the browser. Unlike Adobe AIR, SLOOB (Silverlight Out Of the Browser) applets are fully sandboxed. File access is limited to an isolated storage area. This means easy install without passing a security warning, but also limits its capabilities nearer to those of a Web application.
Silverlight applications can receive remote data using SOAP, JSON or plain XML. Silverlight 3 introduces a binary XML format which will be more efficient for large data sets. LINQ (Language Integrated Query) is supported and you can bind data to Silverlight visual components.
Silverlight components
There is significant third-party support for Silverlight components. Infragistics has two Silverlight suites under the NetAdvantage brand. NetAdvantage Silverlight Controls for Line of Business Applications includes an advanced grid, a dialog window, a tree view and a control bar in the style of Outlook, as well as other controls. NetAdvantage Silverlight Data Visualization includes charts, gauges and geospatial map controls.
Telerik RADControls for Silverlight is a package of 30 Silverlight controls including calendar, chart, gauge, grid view, drag and drop, and more.
ComponentOne Studio for Silverlight includes an HTML panel, a RichTextBox and a DataGrid in a suite of around 35 components.
So Silverlight opens a new cross-platform world for .NET developers, and is ideal for developing internal or external business applications that go beyond what can easily be achieved in HTML and JavaScript. Despite the power of XAML, it is stronger when considered from the developer’s perspective than that of the designer. Developers get use of Visual Studio and a choice of languages together with the strong performance of the .NET runtime, while designers may be less enthusiastic about using Expression rather than Adobe’s tools.
The limited deployment of the Silverlight runtime compared to Flash is a concern for applications that require the broadest possible reach. Often this only means that more users have to install the runtime before running your application, but it increases the risk that you have to troubleshoot the plug-in install as well as your own application. If Microsoft is successful in establishing Silverlight as a media client as well as an application runtime, this concern will diminish over time.
The evidence is that Microsoft is committed to Silverlight, even though it is a cross-platform client that arguably reduces the need for Windows. Compelling Silverlight interfaces were demonstrated at the 2008 Professional Developers Conference as part of the forthcoming Web components for Microsoft Office. As Microsoft invests in cloud services, Silverlight makes sense as an ideal runtime for those services; and the same logic applies to any business developer interested in cross-platform capability and zero-install for the user.
Adobe Flash |
Microsoft Silverlight |
Strengths:
- Broad reach, wide runtime deployment.
- Tools work cross-platform.
- Familiar platform for design community.
- Server pieces strong for Java.
- AIR runtime for desktop deployment. |
Strengths:
- Takes .NET runtime cross-platform.
- Choice of languages: C#, VB, Python, Ruby.
- Excellent performance.
- Strong third-party component support. |
Weaknesses:
- Lacks strong third-party component market.
- ActionScript/Eclipse is weaker tha .NET/Visual Studio
- Server pieces weak for .NET. |
Weakenesses:
- No sign yet of mobile device support.
- Runtime deployment limited compared to deployment of Flash runtime.
- Tools mainly Windows-only. |
|
|
TIM ANDERSON

Tim is a freelance journalist and software developer with a particular interest in Web development and object technology. He has been writing on development topics for over a decade in magazines varying from Personal Computer World to specialist titles such as Developer Network Journal (DNJ).
tima@hardcopymag.com
www.itwriting.com
|
|
|
Find out more...
|
|
|
|
|
|
|
 |
|
|
 |
|
 |
Copyright © 1983-2010 Grey Matter Ltd. All rights reserved. |
 |
 |
 |
 |
|