How do you write a Web App?
Tuesday, 02 November 2010
Article Index
How do you write a Web App?
Silverlight and GWT
Java Applets and JavaFX

Web development is currently the dominant arena for the professional programmer. You would imagine that by now there would be standards-based tools for the job. Instead there is no clear cut way to go about creating a web app and the future is unclear.

So how should we create web applications?

 

Banner

 

The question is so fundamental that it is surprising that it has to be asked and more surprising that there is no clear and obvious right answer. Part of the problem is that the position that we find ourselves in today isn't by design.

The web was never designed to make it possible to build applications of the sort that run on the desktop. The web was all about presenting information in a fairly static form and has slowly evolved some of the facilities it needs to make that content more dynamic. However, at no point has any standards based web technology been seriously proposed with the stated aim of making it possible to write "rich" web applications.

To find this intent you have to look to proprietary solutions. This in itself is strange because you might have thought that by now the standards bodies might have thought of creating something similar to Flash or Silverlight or at the very least have been more ambitious sooner.

However, this is all in danger of presenting a point of view before the evidence so let us take a look at the main technologies available for implementing a "rich" web application.

HTML5/CSS/Javascript

This is the great hope for the near future - but when you look at it objectively it is difficult to see why. The facilities being added to HTML are welcome and progressive but they are not exactly a revolution. The new HTML gives you the ability to use some new user interface elements, a 2D Canvas to draw on, better multimedia, some client-side data storage facilities and extras such as geolocation. However, the fundamental flaw in the mix is Javascript. It really is a wonderful language, but it isn't a first class language in the same way that C#, Java or C++ are. It lacks so many professional facilities that it really does deserve to be called a scripting language.

Many of the demos of HTML5 are impressive, but ask how they were created and the answer is usually with a lot of hard work. Many could and have been achieved using HTML 4 and Dynamic HTML which was never really exploited as much as it deserved.

The big problem with the HTML5 approach to web apps is that it lacks tools. For example, a Flash or Silverlight designer has access to interactive design tools like CS5 or  Expression blend which allows them to create animations and graphic designs without the need for code. Programmers also have their own tools in the form of Flash Builder and Visual Studio which have drag-and-drop designers for the user interface. It is, of course true that tools for HTML5-based development of the same sort could follow but there just isn't the same level of integration between HTML and Javascript as there is between say XAML and C#. For example, how can you extend HTML to include new user controls? It is possible but its not easy, obvious or part of the specification.

The big advantage of the HTML5 approach, and for many this advantage is enough to make it the number one choice, is that it is standards-based and, in theory, available on every platform. If the user can't display an HTML5 page then it's the user's system at fault not the developer. At the moment this advantage isn't realised as HTML5 isn't finalised and browsers are still working towards an implementation. It probably won't be realised in the near future either as you have to cope with users who have older browsers. Its range of application includes building applications for mobile devices and phones without having to worry about specific implementations - but mobile web apps generally need help in the form of non-standard libraries to access the native facilities of the device.

Even so there is the promise of a day in the future when HTML5 will be the norm and so backing it early might make sense.

Flash/Flex

Flash is a plug-in, available for most browsers in use, and Flex is its SDK for building web applications. The Flash plug in supports the ActionScript language, which is a derivative of Javascript. It was originally introduced to allow control of Flash animations. Although the language has been expanded in each version, notably to include a more traditional form of object orientation, it is still best regarded as a scripting language and lacks sophisticated features. User interfaces are designed using MXML which plays the role of HTML in Flex applications. 

Developers can use Flash Builder as their development environment and this comes with a drag-and-drop interface designer. The Flex 3 SDK is issued under the Mozilla Public License and so is open source - however most programmer still view it as a proprietary technology. 

Although it runs using a browser plug-in most browsers are supported and most users have Flash installed simply because it is used to display videos on many popular sites. The capabilities of Flex depend on the version of the player installed and targeted. The latest version is just getting around to supporting 3D graphics.

Most of the problems of using Flex and its desktop extension AIR is that it has grown from the design and animation end of the problem.  Flash was introduced primarily as a platform for special effects and multimedia, not as a general purpose applications environment. It has been slowly developing towards this over time but it is still clear that this is web multimedia technology extended to applications development and then on the desktop.

Clearly Flash/Flex is a reasonable choice for general application development for the web, desktop and mobile devices. Its credibility has been damaged, however, by its exclusion from the iPhone with Apple maintaining that it is buggy and unsafe. Even without the iPhone it still covers a good range of platforms, but it lacks native support on mobile phones.

Banner



Last Updated ( Friday, 31 December 2010 )