AJAX - The Complete Reference

(avery) #1

9 Site and Application Architecture with Ajax


M


oving from a traditional click-send-wait style Web site or application to an Ajax
powered one is a highly desirable goal for both end users and developers alike.
However, simply abandoning the conventions and lessons of traditional Web
development for the latest Ajax pattern may have potentially significant consequences. If
you think such a statement is hyperbole, think again, as employing Ajax improperly can
affect long-standing and relied-upon Web conventions like reliance on the browser back
button or using bookmarks. Fortunately, moving to Ajax doesn’t have to incur negative
consequences if it is planned for correctly. In fact, it is quite possible to design Ajax solutions
that mitigate interface, accessibility, and technology concerns and provide a relatively
smooth upgrade path from the present of Web development to the future of Ajax. In this
chapter, we explore some paths that might be taken to evolve an existing site or application
towards Ajax as well as plan a new one. However, we do warn readers that elegant use of
Ajax is not necessarily easy, and the solutions we present are certainly not the final solutions
to the problems presented. Best practices in Ajax application architecture are still in a
nascent state at the time of this book’s writing.

Adding Ajax


How Ajax should be employed in a Web site or application will depend greatly on the type
of application or site we are dealing with and the value that such techniques will provide.
We might aim to use only small amounts of in-page Ajax that improve experience, or we
might aim to build the entire site or application and move far away from traditional site
architecture.
If at the one extreme, we completely re-architect our application to rely on Ajax, very
likely it will utterly fail if JavaScript is off or the browser does not support the particular
Ajax-related facility we rely upon. Conversely, we might be quite conservative and design
our site or application to not use any Ajax or related technology—but then again, what’s the
point of reading this book if you are going to take that route?
Pragmatic Web developers usually fall somewhere between the extreme all-or-nothing
approaches to technology use. They likely reason, even when being conservative, why not

407


CHAPTER


http://www.ebooks.org.in

Free download pdf