AJAX is normally used to fetch the data and update part of the web page without re-loading the entire page. Sometimes, AJAX is misused by some developers.
If your product/project is totally based on AJAX, when you load the page, you invoke some web handler methods through AJAX to populate the initial data on the page.
When that web page functionality is enhanced, the developers keep adding additional AJAX calls to get additional data.
As the product goes through multiple releases, single web page might end up calling 10 calls just to populate the initial data, when the page is loaded. This is actually a misuse of AJAX.
Instead of making this mistake, developer can use the facade pattern and call one AJAX call and populate the page. That facade call can return a Map, so that it can be enhanced when the functionality of the web page is enhanced in the coming releases.
In the Javascript, the developer can access the initial data from the Map based on the keys.
But in some places, you might not use this facade call.
One of that scenario is the use of Complex AJAX UI Components. The components might internally make the AJAX calls, which cannot be controlled from the container page.
So, while designing the AJAX based UI components, the component designer has to double check whether it is worth calling the AJAX call inside the component or let the container page take care of the AJAX call and pass the data to the component.
If it is not worth making the AJAX call inside the component, it is better to design the component to take the data as an input from the container.
Monday, August 11, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment