Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Putting AJAX Frameworks to the Test : Page 3

Get a developer's assessment of how well the most popular non-commercial AJAX frameworks performed during the development of a dynamic application.


advertisement
DWR—Server-Side Integration Sensation
DWR (Direct Web Remoting) is by nature a different framework from the ones previously reviewed. First, DWR's focus is making browser client/server interaction as simple and natural as possible. Therefore, most of its API is dedicated to client/server interaction. Second, DWR is a Java-based framework, and as such, it is best suited for applications that run Java on the back end.

Because of these properties, DWR offers a very interesting proposition for developing the call-center application. Instead of having AJAX manipulate a text-formatted response from the server, I utilized the DWR asynchronous remote object invocation from JavaScript. I simply represented and invoked the PBX and accounting Java objects on the server from the browser's JavaScript. This provided for a very elegant and concise implementation of the AJAX client's interaction with the server.

In Java, I defined a PBXService object that provides results from a PBX based on the caller's number:



public class PBXService { public String getCallerName(int callerNumber){ ... } }

In HTML, I imported DWR's JavaScript representation of PBXService and the DWR engine:

<script type="text/javascript" src="ServiceProvider/dwr/interface/PBXService.js"> </script> <script type="text/javascript" src="ServiceProvider/dwr/engine.js"> </script> ...

I called PBXService from JavaScript as follows:

PBXService.getCallerName(18003456700, processPBXResponse);

The custom-defined JavaScript method processPBXResponse processes the results from the call to getCallerName on PBXService.

Although not really as elaborate as Dojo or as JavaScript-ingrained as Prototype, DWR offers very attractive server-side integration. For elaborate integration with server-side Java applications, DWR was the best.

Yahoo UI (YUI) Toolkit—Ready for Prime Time
YUI is an extremely rich, well documented, stable, and lush framework for AJAX-based development. Of all the frameworks I used to develop the sample application, it is the one with the most professional feel.

A complete call center application with all the specified—and some unspecified—bells and whistles was easy to implement using Yahoo widgets and connectors. I modeled the presentation aspects, specifically lists and panels, using YUI's Panel and Dialog components. I established asynchronous calls to the backend PBX and account lookup systems with Yahoo ConnectorManager and the familiar callback API, as follows:

var pbxURL = 'http://<server>/ServiceProvider/acctService?callerName=' + callerName;

PbxCallback is a JavaScript object defined as follows:

var requestFromPBX = YAHOO.util.Connect.asyncRequest('GET', pbxUrl, pbxCallback); var callback = { success:handleSuccess, failure: handleFailure argument: { callerName: "N/A" } };

HandleSuccess is a regular JavaScript function that the application calls to read the response from the PBX server. It issues another request to the account lookup service using the caller's name it obtained from the PBX:

var pbxURL = 'http://<server>/ServiceProvider/acctService?callerName=' + callerName; var requestFromAcct = YAHOO.util.Connect.asyncRequest('GET', acctURL, acctCallback);

Figure 2. YUI's Yahoo! Branding on Call Center Application Code

So you may wonder, given the many useful features of this framework, does it have any issues? Indeed it does. YUI is a very brand-specific API that makes clear in every way that it is developed by one commercial company. YUI is maintained by a Yahoo! team who control all aspects of its design and implementation and who use it for the development of their own portal product. While the framework is generally free, it effectively brands significant portions of your AJAX-enabled Web application code as a Yahoo! product as well (see Figure 2). Those developers who are used to working with very generic and neutral open source frameworks (such as Prototype or DWR) may have a problem with that.

In general, however, the YUI toolkit is simple and easy to use. After getting familiar with the framework—which is rather large when compared with other frameworks, developing with it is mostly an assembly process: putting together the components you need and making them work together. The framework also is very well documented, and the test application I implemented with it works well. So overall, my experience with it was very positive.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap