AJAX - Coupling Logic & Presentation Layers?

February 13th, 2006

(This post is cross-posted on SpencerUresk.com)

Without a doubt, AJAX is one of the most popular new web technologies of 2005. Its rocketing popularity has led to numerous frameworks and projects to tie it in with existing frameworks. For example: ICEFaces (Java/JSF), MonoRail (.NET), and Ruby on Rails (Ruby). No doubt, tying AJAX components into an existing framework can save loads of time and cut down on the amount of code you have to write. What about coupling though?

I have taken the approach that AJAX is an entirely new layer, and have tried to keep its code separate from business logic. Why? By doing so, you can change any layer without messing up the other one (in theory!). Suppose your boss decides you need to move from a PHP solution to Java, or from .NET to Java - if you are using an AJAX framework that ties into .NET or PHP, you’ll be stuck rewriting a lot of presentation code that needn’t change.

Likewise, what if you have to move from AJAX to something like Macromedia Flex?
If your PHP, .NET, Java, Lisp, is spitting out generic XML, changing the presentation layer shouldn’t take a ton of work - indeed, I have switched presentation layers in exactly this manner, and did so with only minor changes to server-side code.

Or, perhaps you need to make your website more accessible, but you like the rich and interactive experience AJAX provides. If you are getting generic XML back from the server, you can just make a new presentation version that uses XSLT to create a simpler, more accessible website.

To me, AJAX presents an opportunity to have truly separate presentation and logic layers, but maybe I’m missing something. Am I?

Entry Filed under: Frameworks, Articles

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

February 2006
M T W T F S S
    Aug »
 12345
6789101112
13141516171819
20212223242526
2728  

Most Recent Posts