Comparing DWR as a web framework

Matt Raible recently blogged about his updated presentation on Comparing Java Web Frameworks, and already in the comments there are people asking about how Ajax fits in. So here's my take from a DWR point of view:

First a comment on architecture. In my experience it is easy to create a service layer that works with POJOs and have DWR integrate with that directly, so your service methods are remoted to Javascript. This cuts down on a huge amount of boiler-plate code, and really gets you off to a fast start.

DWR will work with any of the major web frameworks - it ties into Spring well and Bram Smeets and I are working on making this integration better. The next version of WebWork even comes with DWR. BUT the more you get into the Ajax model the more you realize that you are using your standard web framework less and less. Ajax won't do away with the need for a web framework, but it does mean that less server-side code is needed.

Pros and Cons for AJAX / DWR

Pros:

  • Better user interfaces
  • Fast response times
  • Ajax is the "new thing", so it is easy to get enthusiastic about
  • It will integrate with your existing framework

Cons:

  • The need to learn Javascript
  • Extra time needed for an accessible site
  • All quite new, so maybe it is all hype after all?

Comparing DWR with other frameworks

Recognising that DWR does not exclude more traditional frameworks, it is worth comparing using Matt's criteria:

List Screens: How easy is it to code pageable, sortable lists?
For server side generated tables you can still use DisplayTag. For client side tables, use DWRUtil.drawTable which is not as feature-full yet.

Bookmarkability: Can users bookmark pages and return to them easily?
It depends how you organize your site, AJAX sites that exist in only 1 page (like Google maps) may have to take extra steps for bookmarkability.

Validation: How easy is it to use and does it support client-side (JavaScript) validation?
Very easy. DWR integrates with commons-validation and any other validation framework.

Testability: How easy is it to test Controllers out of container?
Very easy. Server side code with DWR is just a collection of Java beans

Post and Redirect: How does the framework handle the duplicate post problem?
AJAX has 2 solutions, firstly AJAX can be so fast that the problem just goes away, secondly since the pages are controlled by Javascript, disabling a button is fairly easy.

Spring Integration: Does the framework support using Spring in the middle tier; how easily?
Yes. DWR can remote spring beans - it doesn't get much easier than that!

Internationalization: How is i18n supported and how easy is it to get messages in Controllers?
AJAX in general and DWR in particular do not attempt to solve the i18n issue, use one of the other frameworks in tandem with DWR to get i18n.

Page Decoration: What sort of page decoration/ composition mechanisms does the framework support?
DWR works with both Tiles and SiteMesh.

Tools: Is there good tool (particularly IDE) support for the framework?
IDEA v5 has updated Javascript editing functions that can really help web development.

Marketability of Skills: If you learn the framework, will it help you get a job?
Maybe not today, but certainly tomorrow.

Job Count: What is the demand for framework skills on dice.com?
9 for AJAX (wow!)

[Update: Fixed the spelling of Raible! - Sorry Matt.]
[Update: Fixed a typo.]

Comments

Comments have been turned off on old posts