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

 

Silverlight

Silverlight is often said to be Microsoft's challenge to Flash/Flex and it is reasonable to compare them. It too is based on a plug-in. However there is one big difference that explains a lot. While Flash started as a special effects animation tool and grew towards applications first on the web and later on the desktop, Silverlight started as a programming environment for the desktop and worked its way to the web. What this means is that Silverlight development is much more like desktop development with a few restrictions and missing features.

Silverlight applications are run with security restrictions unless the user grants permissions to the app. They can also be installed out of browser when they look like standard desktop applications.

Silverlight is derived from WPF and .NET, Microsoft's main desktop development environment. The C# language used is a first class modern language used to develop server and desktop systems - it certainly can't be described as a scripting language. The tools used to build a Silverlight application are also the same as those used for the desktop, i.e. Visual Studio. A drag-and-drop editor is used to create the user interface, which can be coded with XAML playing the role of HTML. A specific designer IDE is also available in the form of Expression Blend which supports the creation of user interfaces and animations which can be deployed or exported to Visual Studio for integration with code. 

So the big plus for Silverlight is that it is a well-developed  system based on a full programming language and nearly indistinguishable from desktop application development. The big negative for Silverlight is that it is proprietary code and for some the fact that the proprietor is Microsoft is another big negative.

The Silverlight plug-in isn't as ubiquitous as Flash, although it is easy to download and install. It also doesn't work on all platforms. It works on all versions of IE from 6 up, Firefox 3, Safari and Chrome and on the Mac using Firefox or Safari. It doesn't officially work on Linux at all but an alternative open source plug-in Moonlight is available. Moonlight is supported by Microsoft but it has lots of deficiencies and currently only supports Silverlight  2 applications.

Work is continuing on the Moonlight project, however, with a Silverlight 3 plug-in available in alpha and a Silverlight 4 plug-in about to be released in alpha. Even so many developers still consider that Silverlight hasn't become sufficiently platform-independent and it also isn't supported on mobile platforms - with the exception of Windows Phone 7.

Windows Phone 7 has adopted Silverlight as its main development environment. As such this makes it particularly easy for any .NET developer to create Silverlight applications for this particular mobile device.

Overall the advantages of Silverlight are a well-developed and professional environment for creating web applications, but without quality Linux support and wider mobile support, it may be regarded as unsuitable by many.

Google Web Toolkit (GWT)

Now we come to an interesting and radical way of getting around the problem that Javascript isn't a top notch professional programming language. The idea of Google Web Toolkit GWT is to take a Java application, complete with user interface, and compile it into Javascript and HTML. This allows the developer to work in Java but still target any browser that complies with the HTML/Javascript standards.

At the moment the compiler targets a range of browsers by generating Javascript which check to see what environment they are running in and adjusting the code. The application can be tested in development mode as Java code before being cross compiled and deployed in a browser.

In principle you can use any Java development environment and use the cross compiler to deploy the finished application, but Google make available a plug-in for Eclipse that is easy to use.  Of course, as well as the complied Javascript/HTML application, you also have the Java source code which can be run as a desktop application.

The success of this approach depends on how well the cross compiler is implemented and the ease of expressing general UI components in terms of HTML and Javascript. So far the UI looks convincing with buttons, datapickers and layout panels mimicking the equivalent Swing components. There are also third party widget libraries and many widgets under development.

One of the problems that GWT has is that it is often misunderstood as just another Javascript library. GWT isn't just a library; it is a complete development environment and cross-compiler that allows the programmer to work in Java and treat Javascript/HTML as a sort of up-market assembly language. It may not be the most commonly used approach to building web apps but in the future coupled with HTML5 it could just be the answer we are looking for.

Banner



Last Updated ( Friday, 31 December 2010 )