|Please take note:
Latest news ! gwtClassRun has been released in beta to facilitate GWT application development.
Introducing gwtClassRun to aid GWT application development
A IDE like Intellij is definitely a must for GWT. Experience the debugging power using breakpoint.
Though AJAX technology is the rage nowadays with many libraries and framework that purported to bring the desktop application experience to the mass, it also hamper by the fact that those libraries with their large code size incur a noticeably download and Initialization waiting time that might irk user. It is therefore relieving to find a compelling solution like GWT that helps alleviate the wait.
Coming from Java background that cognizant of writing desktop application, I have to say that developing AJAX-based web application in GWT feel natural and is a breeze to use. A lot of power and flexibility from what seems as a elegant and simplistic framework.
To illustrate the problem, consider the approaches of traditional web development in comparison to GWT’s equivalent.
- Traditional JSP Web Development
- GWT Web Development
On the other hand, web application is built entirely using Java class. In GWT, executable class is implemented by EntryPoint interface which consists of a single method
public void onModuleLoad() whose code will be run upon execution. Prior to execution, the GWT project’s respective gwt.xml file will be altered to have its entry-point tag reflection the execution class. Therefore, every class that need to be executed has to implement the interface and gwt.xml change to indicate the relevant entry-point class to run.
So exactly what price to pay for using GWT ? Fortunately, it is not a monetary price since GWT is free and open-source with courtesy of Google . Still, that price is much subtle and cause much frustration to developer as application size become larger. The price is slow compilation and inefficient testing.
Still, other will like to say unit test is supported by GWT but this is not without creating helper class again.
Before recommending the solution, I will first like to describe the enjoyable experience of developing a desktop application using Java in a IDE because this experience is what propelled me to improve on web development using GWT.
One wonderful thing about Java is that each class is self-testable and runnable as long as there is a main method exists in the class with the signature:
public static void main(String args)
So a GUI application is build incrementally, with each class construct and test easily through its main method. In Java, everything is class, and Dialog, Windows, Application are all represented by class and testable in its own right.
So a IDE augment the productivity by giving the developer a convenience option to run or debug a class as long as a acceptable main method is available (Generally as a menu choice), with no question ask. At the same time, developer can also create a definable configuration with its own setting and specific class to run when invoked. In most time, developer will likely be interested in testing the class under development not the application as a whole (eg One run the method directly without having to click a button to invoke a class method)
And this way of development is very productive, to say the least, and efficient because IDE only intelligently compile the Java class and its related modified class that change and run it and need not wrap it into JAR file until deployment. You can just as easily test a class not the whole application.
So in thinking out solution for GWT’s noticeably slow compilation, I curiously and playfully think along the same line of
What can’t the same Desktop Application Development paradigm be applied to GWT since GWT is attuned in developing application not web page ?
A mindset change required that the developer run and test class (Whose size can be compiled and run faster) more often than whole application (The increasing size means long waiting time).
Taking the clue from the Java development, the following solution is proposed. The feasibility of such solution depends not only from GWT but also explicit support from the IDE.
Designate a special optional executable main method in GWT’s Java class that will be executed upon invoke manually by developer.
public void main()
A class that implements EntryPoint interface indicates that this class will be executed upon running the GWT’s project. However, by putting a main method, any class will be executed upon manual invocation by the developer only. For example, one can access class function by context menu as shown in IDE.
GWT may also like to include helper class that facilitate testing of class eg TestRoot.
Main method is generally used for testing by IDE and not access as a normal usable method. Sometimes, this method could have a lot of heavy lifting, therefore GWT by default will automatically remove this irrelevant method during compilation. Still if the developer want to include this in resultant file then a annotation can be used to mark it as special.
Example of GWT Java class using main and annotation
Note that this method doesn’t replace the quest of improving the compilation time (After all, the whole web application needs to be tested and deployed ultimately), but rather serve as complementary way to use GWT effectively and efficiently as possible.
With this in mind, I will like the GWT team to seriously consider this useful enhancement in the forthcoming release of GWT because this really help to improve the productivity of developer through testing only pertinent class without incurring the consuming time require to compile superfluous code or altering configuration file (eg gwt.xml) using the sole EntryPoint approach. This also be plausible solution in long term for large enterprise application development.