Ajax best practices



-         Don’t misuse it: use it when it has a real added value for the user.  I already heard people proposing to implement the entire navigation through ajax. The application runs with a single page with a div in the centre. When the user wants to navigate just refresh the div!  This is typically a misuse of the technology; it will enhance the complexity of the entire application and lowers the user experience because the user will be confused. e.g. user will be unable to use the back button.

-         Always provide a fallback solution because:

o       ajax isn’t compatible with old browser

o       disabled people usually are not able to use features that are only available through ajax,

o       people who have javascript disabled can’t use it.

o       most important: search engines are unable to index information only available through ajax.

-   Delay as much as possible: Ajax and JavaScript in particular should be used as lately as possible in the development cycle.  Incorporating ajax too soon tends to make changes more costly. In my opinion it's a bad idea to use ajax when the project is still in a early period of his lifecycle because their is a high probability that many changes will happen. Best practice is to use a dedicated iteration for adding the ajax and JavaScript effects.

-         When the UI and the backend are not made by the same developers, UI developer and backend developer should absolutely be physically close making part of the same team.

-         Decouple the presentation layer with the application logic and decompose the UI (pages) in different parts (modules).  This practice will facilitate the integration afterwards of the ajax effects.  Our team use a specific pattern.   Basically the module code is used in the classical way (without ajax) and re-used afterwards by javascript code that calls these modules through the scriptacoulous Ajax.Updater method.

18:00 Écrit par Geoffrey Vandiest dans Web | Lien permanent | Commentaires (12) | Tags : patterns, ui, development, ajax, practices, javascript |  Facebook |