February 7th, 2010

by Ivan St. Ivanov

JavaScript frameworks compared

The JavaScript language is very heavily used in many web sites. It has the features of both the dynamic and object orientated languages and makes the static HTML pages look shinier. With the advent of AJAX and the rich internet applications, the importance of JavaScript has become even greater. Of course some of the rich sites use other technologies like Flash, Wicket, GWT (which eventually translates to JavaScript), Java Applets, Silverlight, etc. But JavaScript is still ubiquitous.

One of the problems of JavaScript is that it is incompatible across the different browsers (Internet Explorer, Firefox, Safari, Chrome, etc.). It also does not come by default with all the GUI components that are usually used in a page. Well, it is not a component framework after all.

However, there are some JavaScript libraries that help us in those directions. They provide standard objects and functions which do all the standardization and boilerplate for us. The author of the above article discusses several aspects of a typical JavaScript program (DOM tree manipulation, utility functions, event handling and AJAX) and explains how the most popular JavaScript frameworks support them – what are their built in objects and functions that do the job for us.

At the end there is a comparison between all these frameworks and the features which they support. I was surprised that Dojo was not in the list of the compared libraries, but only in the ‘Others’ section, but anyway. Even without it the article looks interesting enough.

Google App Engine, JSF and Weld – part 1

In this article you can see how you can easily create and host a web site using some of the hottest Java technologies and solutions in the industry. So let’s start one by one…

The hosting solution is provided by Google app engine (GAE). It started about an year ago and initially could host applications written in python. But in a little while it provided the same service (with very small limitations like disabled multi-threading for example) for Java apps. And the best thing is that if you don’t go over the free quotas, then you don’t have to pay for the hosting service. As you can see from the above linked figures, this is a perfect proposal for a site with not so many users and not so high traffic. Google also provides an SDK, which can help you run your application locally, as well as a plugin for integration with Eclipse.

The author of the article starts exactly with that – how you can create a Google App Engine account and then how to create your project. The next step is setting up the presentation layer using the JSF technology. As it is a simple Hello world application, there is not so much of the JSF itself, rather than the author spends most of the time in explaining in detail how to configure it so that it can be used in the GAE environment. You can see very well explained all the bits and pieces of the web.xml configuration.

Next comes the technology that backs JSF. It is the Java Contexts and Dependency Injection represented by its reference implementation – Weld. Using this you can create a plain old java object, which methods can be called in the JSF pages.

Finally, after you have built the application, you can run it on a local web server provided by the GAE SDK. And if you are satisfied, then you can deploy it via the Eclipse plugin to the Google App Engine on the internet.

Debugging and testing Swing code

I suppose most of the readers of this blog have the experience of doing GUI programming. In the Java world the most common way to do this is to by using the Swing technology. Of course Java FX is emerging these days, but all the legacy Java standalone applications use Swing.

The author of the article points that sometimes if you need to understand and later on support such an applications is a very challenging task. Swing is so flexible and feature-full that you can express a very simple program window in more than one way. In addition to that different events can cause hiding of some of the controls and the components and showing up of others. This makes understanding the structure and testing the GUI even harder.

In this very interesting article you can find out how a couple of libraries can help us find out which are the components that build up the application interface, how are they structured, which are the exact Java classes that are used to visualize those components and display the components’ properties etc. You can also run some behavioral tests using a special Java domain specific language in order to find out whether clicking some buttons, menus, etc. produce the expected behavior. It is achieved not by simply using screen coordinates and generating some mouse clicks or keyboard strokes, but is goes on another level – the components are distinguished by their names and the user events are more sophisticated.

You can read the article for more details.

Soft skills article of the week

And now for something completely different. Martin Fowler (the author of the terms inversion of control and dependency injection) speculates on what is the correct way of task definition in the agile processes. Most of the people think that developers should not care about defining the user stories as it is the responsibility of the product owners (or system analysts). However, according to the author the defining (or actually the refining) task is a mutual responsibility of both parties.