Choosing Web-Frameworks

In this article series, we are going to explore web frameworks from a Java point of view. It covers Java based frameworks and frameworks based on scripting languages that can run inside of a Java application server. The latter are for example Ruby, Python, PHP, Groovy based frameworks. This article is taken from my eBook ‘The Web Framework Evaluation’.

You can get the eBook at <http://www.laliluna.de/shop>.

Difference between the free article and the eBook in PDF format.

Table of Content

In this article series, we are going to explore web frameworks. I would like to answer a simple question at the end of our analysis

What is the best web framework or technology for my web application?

Since 2007 I continuously tested web frameworks to find a suitable solution to use after Struts 1. Over the last years, I have visited a number of conferences (Java One 2009, Devoxx 2008, Java One 2008, Jaxx 2007) and took the chance to listen to presentations on this topic.

After all this testing and proof of concepts and exploration, I really wanted to publish an article. Well, here it is.

I will name a lot of technologies in this article. You can find a link and short description to all named technologies in the appendix.
Why is finding the best web technology so difficult?

Basically because of two reasons. The technology landscape has completely changed. A couple of years ago a web application was a quite precise term for an application based on something like Struts 1, JSF, Tapestry, Cocoon or in worst case on plain JSPs with servlets.

Today there is by far more choice of technologies and technologies can even be combined.

Second, the requirements for modern web applications have rapidly changed. We will explore both reasons in the following.

Let’s have a look at the technology landscape first.
A short review of technical options
Javascript applications

There are applications rendered by Javascript on a single page. The look and feel of these applications is close to that of desktop applications running on your operating system. Technologies in this area are Google Web Tool Kit (GWT), JMaki and Dojo.
Plugin based applications

The web application is rendered by a browser plugin. A number of technologies compete with different concepts. Here you can find old and new technologies like Adobe Flex, Microsoft SilverLight, JavaFX, and Java Swing started with Webstart. You have read correctly, Java Swing applications come to new life with the modern requirements of more interactive web application.
Classical web frameworks of the new generation

In the classic web framework arena there is a new generation of frameworks with the functionality already included which was missing a couple of years ago. A complete list would include probably more than 200 frameworks. Here just some candidates in alphabetic order: Apache Shale, JavaServer Faces, JBoss Seam, MyFaces, Stripes, Struts 2, Tapestry and Wicket. The frameworks do either include Ajax supporting tag libraries (with JSF you can use an external Ajax components) or you can combine it with an Ajax library.
Ajax libraries and widget to spice up your life

There are Ajax library and Ajax widgets collections. Just to give some more names: Jquery, Jquery UI components, Prototype, Scriptaculous extension to prototype, Mootools, MochiKit and Rico. They can be combined with the latter frameworks to spice them up and provide the modern look and feel of web applications. Yahoo provides a popular widget collection as well.

But still there is more.
JRuby, Jython, Groovy, Scala, PHP

Dynamic languages pours into our Java world. There are mature languages like Ruby, Python, PHP and new languages like Scala and Groovy which can nowadays be integrated more easily with Java. Based on those languages you will find an even greater choice of web frameworks.

In addition you can use dynamic languages to write Java Swing applications.
RESTful application

Finally another technology becomes more and more famous: RESTful web services and web applications. REST is an acronym for Representational State Transfer. The origin of this term is a dissertation from Roy Fielding. Roy researched typical characteristics of the world wide web and defined principles for the web which can be translated into principles for web applications. Understanding these concepts is crucial as they are the basis for the success of the web. RESTful application and RESTful webservices strictly follow these principles.

RESTful applications use the underlying protocols correctly. This will help us around a lot of frequent problems of web applications and provides us with a very clean approach. These principles are in conflict with stateful web frameworks like Wicket or JavaServer Faces. You will see that, it is going to be interesting to discuss the different approaches.

I would like to thank Stefan Tilkov for his speech at the Devoxx conference, where he talked about the importance of these characteristics for web applications.
New requirements for web application

New frameworks don’t spring up like mushrooms if there is not a demanding environment. There are a number of players who brought forward new requirements. One is Macromedia who coined the term Rich Internet Application (RIA) to describe their flash based technology. Basically they mean an application started by a plugin, rendered on a single web page which provides the look and feel of a desktop application.

A little bit later the Ajax idea appeared to describe the use of Javascript, asynchronous calls to the backend and CSS to make web application more dynamic. We all know Ajax today but in fact its use in web applications is still very basic.

In my opinion, we can summarize all this discussion pretty simply.

Web applications should look and feel like desktop applications.

How does a desktop application look? Well, let me explain it this way. Open your OpenOffice Writer and well that’s it. But at least, let us try to put together a list of some typical characteristics.

There are quite a number of things which are available in desktop applications. One thing, you should take for granted is that offering support for this functionality in web application will come with a trade off. Having access to the operating system clearly changes the security concept of browsers. But this is already possible today but not standardized. Have a look at technologies like Google Gears which installs a browser plugin to let a web application interact with the desktop and provides access to a local database.

Something that is not appreciated are the tradeoffs of desktop applications like installation, uninstallation, operating system dependency, etc.

At the end I would to introduce another requirement which is addressed by technologies like Adobe Flex or JavaFX. These are graphical effects including multi media content. These applications no longer look like business applications but have rich animations and do include all kinds of video, sound an animation. This can require hardware rendering of a modern graphic card.
Summary

We had a first look on available web technology. Hopefully, you got an impression of the wide choice we have.

Then we have talked about the so-called new requirement, didn’t waste to much time for this but just defined that there are two of them