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.
- eBook is printable
- eBook includes the upcoming detailed framework evaluations about 1-2 months earlier
- eBook includes a number of performance and load tests showing rendering performance and memory consumption under load.
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.
- Copy and Paste
- Drag and Drop
- Selecting content and applying an effect / function / format
- Context menus = right click
- Mouse Over effects
- Menus
- Menus can be accessed using keys
- Keyboard short cuts can be defined to execute special functions
- Selecting content is actually a very wide area, starting from selecting text up to selecting a number of elements in a presentation
- Visual components like sliders, panels, trees, table, grids, input components, charts and diagrams
- Control of the user interface, the user can close the application but apart from this, you can control every piece on the screen
- Interacting with the underlying operating system, hard disk access, connecting to the network
- Interacting with other application which can be related to Copy and Paste as well
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.
- There is a new generation of classic Java based web frameworks either supporting Ajax with their tag libraries or inviting you to use Javascript libraries to spice them up.
- We named completely Javascript based applications running on a single browser page.
- Then there were technologies, also running on a single page, but rendered by a plugin.
- We had a quick lock in the world of dynamic languages.
- Finally we spoke about RESTful applications.
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
- Web applications should look and feel like desktop applications.
- Web applications should be able to include rich animations and multi media