Spring [br /] - Robust Ajax Architecture
Rob Gonda gave an interesting session on ajax architectures.
Best practices for architecting your ajax apps. Ajax is supposed to reduce server load, but if you are not careful, you could easily increase the server load exponentially (e.g. an out-of-control autocomplete widget). Flex/Flash are better suited for larger RIA applications.
JSON (JavaScript Object Notation) is becoming very popular lately. It is native to javascript, making it very fast on the client side because it doesn't need to be parsed like xml needs to be. Two open course projects that help integrate JSON and ColdFusion: cfjson (http://www.epiphantastic.com/cfjson/) and another one that one that I didn't catch.
Use javascript libraries and frameworks. Frameworks allow you to code for the library and not for a specific browser. There are many to choose from, each with pros and cons. Rob regularly uses and is a big proponent of jquery.
Flash plays friendly with Ajax. Rob uses Flash for XML Sockets messaging services--ColdFusion Enterprise gateway. Adobe Ajax Data Services (ADJ)--Ajax interface to Flex Data Services.
Potential Problems: back button, url history/bookmarking, search engine indexing, client side business logic, viewable source code, etc.
Architectures: return data, return html, return javascript. Don't code your business logic in javascript. Return javascript from your ColdFusion app which then gets eval()-ed in your app. Good separation of logic (MVC). Use innerHTML() to modify content and eval() for logic (only on the client, never on the server). For example, your server would send a string like this: "$('mydiv').innerHTML='some new text';", which then gets executed on the client side with a simple listener that simply evaluates the returned string with a javascript eval() call. Business logic and data should stay on the server, but it can really be up to you whether some of the UI logic exists on the client or server. Your AJAX should only be in the View of MVC.
Degradable sites--very important. Easiest way is to use hrefs + onclicks (very easy to do using an unobtrusive framework like jquery).

There are no comments for this entry.
[Add Comment]