The future of the Web
By Tim Anderson
New platforms for building Web applications are appearing all the time. Tim Anderson checks out the latest batch.
HardCopy Issue: 49 | Found In: Development | Published: 13/09/2010 | Last Revision: 17/09/2010
Client development is getting interesting again. The days when a Windows-only Visual Basic application would meet most needs are long gone. The benefits of cross-platform support and zero deployment make Web applications attractive, and businesses are also interested in reaching their customers through mobile applications for iPhone, Android and other devices. On the server side, the case for designing applications that expose services suitable for use by a variety of clients is stronger than ever, but it still leaves hard decisions about what client platform or platforms to support. Build a Web application and never mind those users who want to work offline? Use Adobe Flash and forget about Apple’s iPhone? What about Microsoft Silverlight? Each platform has its strong points, so let’s check out the current state of play in this rapidly changing market.
Ajax and HTML5
Technically HTML5 is a standard, still in development, which will replace HTML 4.0 as the specification which Web browsers implement. To put it another way, HTML5 is about pushing the limits of what can be done with HTML and JavaScript in browser-based Web applications. In a sense it is the next generation of Ajax, which was the buzzword of the day when developers realised that things like partial page refresh and background data retrieval were possible without using a plug-in.
The big problems with HTML5 are that the standard is still in development, and that the process of users and businesses upgrading their browsers is a slow one. A point of confusion is that there are two HTML5 specifications, one managed by the W3C (World Wide Web Consortium) and another run by WHATWG (Web Hypertext Application Technology Working Group). However both have the same editor in Google’s Ian Hickson, and the WHATWG version is intended to be a more experimental superset of the W3C specification.
Despite these handicaps, the latest browsers are already implementing significant parts of HTML5, and the capability of Web applications is increasing. Even Microsoft, whose Internet Explorer has lagged behind others such as Firefox, Google Chrome and Apple Safari in implementing Web standards, is getting behind HTML5. Internet Explorer 9 is about to be released in beta form, with final release expected in 2011, and HTML5 support includes Scalable Vector Graphics (SVG), the Canvas element and the Video tag. IE9 also supports hardware graphics acceleration and a new JavaScript engine code-named ‘Chakra’ that does background compilation to achieve much faster speeds.
Support for the Canvas element means Web applications can draw and paint whatever they like to an HTML page, which means in principle that that any sort of user interface can be created with sufficient effort.
One of the characteristics of what we loosely call HTML5 is that it combines several distinct technologies, namely HTML itself, CSS, the browser DOM (Document Object Model), JavaScript, probably XML, and probably one or more JavaScript libraries. It is also likely that a project will also use a server-side language such as PHP or ASP.NET. This is challenging for the tools vendors. Adobe has released an HTML5 pack for Dreamweaver CS5, which already has good support for PHP. This updates the code hinting and offers a Multiscreen Preview to make it easier to test for a variety of screen sizes. This pack is currently in preview on the Adobe Labs site. However, Dreamweaver is more a design tool than a coding tool. Another project worth mentioning is Google Web Toolkit, which lets you work in Java and Eclipse, while compiling to client-side JavaScript.
The advantage of Ajax and HTML5 is simple: it works on any device without any local deployment or plugin dependency, provided that the browser supports the features used. HTML5 is emerging as a capable application runtime. The disadvantages include coping with browser differences and older versions such as the antiquated Internet Explorer 6, mixed tooling support, lack of offline support, and difficulties integrating with the local operating systems and applications (should that be necessary). In practice it may be necessary to invoke a plugin such as Flash or Silverlight for certain browsers or platforms.
Adobe's Flash Platform
According to the statistics site riastats.com, Adobe’s Flash player is installed on over 96 per cent of active Web browsers, with over 90 per cent being version 10 or higher. This high penetration makes it an attractive runtime for application development.
Flash is also a capable runtime. Flash Player 10.1, released earlier this year, has several significant improvements. Perhaps the biggest is support for mobile devices, with Google Android 2.2 the first to benefit. Another enhancement is the ability to define a global error handler, so improving the user experience in the event of an unexpected error. Features designed with mobile in mind include multi-touch support (which also works on Windows 7 and to a degree on Mac OS X), accelerometer support, a pop-up virtual keyboard for text input, plus hardware graphics acceleration and video on Smartphones.
Adobe Flash is supported throughout Creative Suite 5 and generates content that runs in most Web browsers across multiple platforms.
Along with Flash Player 10.1, Adobe has released AIR 2.0, the second version of its desktop runtime and also being adapted for Android. AIR counts as a Web client in that it runs on the desktop but interacts with data and services through the Internet. It supports a variety of Web services including SOAP, plain XML, Adobe’s own LiveCycle Data Services ES2, or the free version called BlazeDS. The Adobe services run on top of Java on the server and deliver data and remoting services to Flash using the optimised Action Message Format (AMF).
AIR 2.0 has additional features, including the ability to launch local applications through the default file handler. It can launch Excel so that you can interact with an XLS spreadsheet, for example.
Flash began as a multimedia plug-in and that heritage still shows in that the player is excellent for rich graphics, sound and video. While this may not seem an obvious advantage for business applications, it is a good fit for business intelligence or any application that does data visualisation. Communication is another strong point, and Flash can have access to a microphone and camera for custom conferencing.
Adobe has woven Flash support into almost all of its tools, including the applications in Creative Suite 5 for designers, and the Flash Builder development tool which is based on Eclipse (the basic version of Flash Builder is also bundled with Creative Suite 5). Integration between Flex code and Flash visual design is not quite perfect, but still very good. The new Catalyst tool lets designers prototype or build Flash Builder applications without writing code, and enables developers to import Photoshop images and convert them into live components.
So Flash provides Web developers with a rich and consistent runtime, irrespective of the host browser, as well as an interesting cross-platform desktop option, and has strong tools for both designers and developers. There are a couple of disadvantages, though. One is that Apple does not allow Flash on iPhone or iPad, and mobile support in general is only just getting started for the full version of the runtime. Another is that, despite its wide use, the Flash player is a plug-in, and that gives users an additional dependency. In an ideal world HTML5 would be preferable, but it will be some years before it has the wide deployment Flash offers today, by which time Flash may have leapt further ahead.
It is not quite Visual Studio, but Adobe Flash Builder is now a mature tool for coding Flash applications.
Silverlight and Windows Phone 7
Microsoft Silverlight is a browser plug-in that lets you write multimedia and .NET applications which run in the browser and are cross-platform on Windows, Mac and to some extent Linux. There is also an out-of-browser mode which enables Silverlight desktop applications, much improved in the latest Silverlight 4.
Silverlight is also the development platform for Windows Phone 7, alongside the XNA framework for games. (XNA is a .NET wrapper for DirectX development.)
According to riastats.com Silverlight is installed on 62 per cent of active Web browsers, and 52 per cent run the latest version 4. While this is impressive penetration given that Silverlight has only been around for a few years, it is well behind Adobe Flash. Nevertheless, it is growing fast, and for most users is a quick and easy install.
Silverlight has a close relationship with Windows Presentation Foundation in desktop Windows. Both use the XML language XAML to define the visual part of an application, including effects and multimedia, and both use .NET for programming. The platform took a leap forward with Silverlight 4, released earlier this year, which adds a host of features including printing, clipboard support, new controls including a rich text area, access to camera and microphone, and an option to run with elevated trust to gain features such as local file access.
Using Visual Studio 2010 to build a Silverlight application that will run on the Windows Phone 7 platform.
Out-of-browser applications, which put Silverlight in competition with Adobe AIR, are much improved in version 4.0. Among the enhancements is COM interop, which lets a Silverlight application communicate with COM servers such as Microsoft Office applications, though this only works on Windows.
Silverlight has many of the same advantages as Flash, offering a consistent browser-independent runtime with rich graphical and multimedia capabilities. The .NET runtime in Silverlight gives developers a choice of languages, and Microsoft’s C# is more advanced than Flash ActionScript. That said, Silverlight out-of-browser is less complete than Adobe AIR, and lacks a local database engine.
WCF (Windows Communication Foundation) RIA services are another significant part of the Silverlight platform. This is a component that runs on the server and simplifies authentication and data access, including data validation.
A key strength of Silverlight is the Visual Studio development tool, especially in the new 2010 version which includes a two-way visual designer. The debugging experience is good, with the ability to debug seamlessly between ASP.NET on the server and Silverlight in the browser.
Silverlight also has its own design tool in Microsoft Expression Blend. This is an advanced graphical and interaction designer, and also includes a prototyping tool called SketchFlow for quickly assembling screens and interactions that can be shared for review and comment. Expression can import images from Adobe Photoshop and Illustrator, with a high level of fidelity. This is a complex product though, and takes a while to learn.
Silverlight is a great solution for .NET developers who need to create Web applications that cannot easily be created in HTML, or to support both Mac and Windows with an out-of-browser application. Silverlight 4 is a major advance on earlier versions. Third-party component support is also strong. The arrival of Windows Phone 7 adds a mobile platform for Silverlight, although the initial launch primarily targets consumers.
There are also a few reasons not to use Silverlight. It lacks the broad reach of Flash, and is no more likely to be supported on Apple’s iPhone or iPad. Linux support is left to a third-party, Novell’s open source Mono project, and tends to lag the official release. The designer tools are inferior to Adobe’s Creative Suite, and Expression Blend requires Windows, whereas many designers work on the Apple Mac.
Mobile: the new cross-platform challenge
Mobile is the most exciting area of IT, both for business-to-business and business-to-consumer applications. The new generation of smartphones are capable computing devices which are generally internet-connected: they do multimedia, they do Web browsing, they have significant local storage, they are location-aware. They are important Web clients, both for Web applications viewed in the browser, and for native applications that rely on internet services.
Mobile is a great opportunity for developers, but also poses a cross-platform challenge reminiscent of the early days of personal computing. Numerous mobile operating systems are jostling for position, each with its own development platform, and when Adobe opened up a possible solution with Flash and AIR for mobile, Apple stated clearly that it would not allow the Flash player or even Flash-authored applications onto its iPhone and iPad devices.
This means that developers who want to support all the main mobile platforms with native applications have a lot of work ahead of them. The following table shows the options:
Diverse mobile operating systems have existed for a long time, and until recently users hardly noticed. The add-on application market was relatively small, and most devices supported some level of Java Micro Editon (Java ME).
Apple changed the industry with its App Store, making it easy for users to find and install apps from the device itself, and using app availability as a key reason for buying the device. The consequence is that a smartphone now needs a strong application market and community in order to succeed, making it harder for new device platforms to become established.
The obvious solution to this problem is some kind of cross-platform framework that would let developers write one application and build for multiple devices. Such frameworks do exist; one example is Appcelerator, another is the open source PhoneGap. Apple has caused confusion though, by making developers agree that “only code written in C, C++, and Objective-C may compile and directly link against the Documented APIs.” After this clause in Apple’s terms appeared, Adobe stopped work on its packager for iPhone, which lets you compile a Flash application to native iPhone code. That said, other cross-platform tool vendors have said they will continue supporting iPhone. “It’s our belief that we are fully in compliance with iPhone OS 4.0 ToS as we interpret them. We agree with others that the intent behind the language is probably aimed at Adobe,” said Appcelerator’s Jeff Hayne in a blog posting.
Despite Apple, Adobe aims to position Flash as a cross-platform solution for the other mobile platforms, though it will be a while before the 10.1 player and AIR support is widely deployed.
A mitigating factor is that mobile browsers are getting more capable, with the open source WebKit engine widely used in new SmartPhones. This means that the browser itself is a strong application runtime, particularly when Web applications are customised to support small screens.
Another issue with mobile development is the extent to which the various platforms are locked down. Consumer applications for the iPhone must all pass through the App Store, giving Apple 30 per cent of the price as well as control over which applications are allowed. This can be frustrating to developers, since the approval process is not transparent.
That said, Apple also offers an Enterprise Program, which lets businesses deploy custom apps to their staff via iTunes, avoiding the approval process. Microsoft has yet to announce any equivalent for Windows Phone 7; all applications will go through the Marketplace at launch, though this may change with a future release that is more business-focused.