J2Page: Comparison with Google Web Toolkit
The Google Web Toolkit (aka GWT) is Google's Ajax framework which much like J2Page takes the
Java-to-JavaScript translation route. However there are many key differences between GWT and J2Page:
-
Widget APIs: GWT provides a rich API for building applications, in particular a library of predefined widgets, and a GWT application is typically built by combining these widgets into a page. J2Page on the other hand does not provide its own widget-set but rather provides Java bindings to many of the more popular 3rd party JavaScript libraries such as Dojo, OpenRico, etc.
-
Server Communication: GWT includes its own proprietary RPC mechanism to be used to call back the server, while J2Page simply aims to make use of existing solutions such as DWR, the Dojo Toolkit's dojo.io package, or standard REST and/or SOAP web services.
-
Generated vs. Handmade HTML: In GWT, the HTML that defines the interface is typically generated behind the scenes when compiling widgets. Modifying the view at the pixel level in GWT therefore typically requires reverse-engineering the generated HTML back to the widget that created it. By contrast the typical J2Page approach is to design the interface in a static HTML file and then attach dynamic behavior to the page elements by manipulating the interactive elements of the page in Java. This leads to a much stronger separation of the from the view.
-
Generated JavaScript: Because of the emphasis on using the same APIs available to JavaScript programmers, the JavaScript code generated by J2Page looks almost exactly like the original Java source - the only differences are those needed for the code to be interpreted as JavaScript by the browser. For example, class, method and variable names are not changed at all unless absolutely necessary, making it easy to work backwards from possible bugs in the JavaScript. While the JavaScript generated by GWT does maintain some similarity to the original Java source, it's clear that there is a much more complex "compilation" step occuring.
-
Peformance vs. Portability: Parts of the GWT seem to be coded in C++ whereas J2Page is 100% Java. Thus GWT is able to provide native builds for Windows and Linux but it is more difficult to get working on other platforms such as Mac OS X.
The bottom line is although GWT and J2Page may seem superfically similar due to the Java-to-Javascript mechanism employed by both, in reality the two work in very different ways. The details of your particular project will determine whether either of these tools is best for your needs.
|