Ajax applications can contain much more client-side code than a standard web application, and hence benefit much more from the order that patterns and refactoring bring. This excerpt from Chapter 4 of Manning’s Ajax in Action is the second of three excerpts that apply refactoring and patterns to the client-side codebase. You won't see much of the asynchronous requests that give Ajax its name in this chapter, but the style of programming that being discussed here is a direct consequence of being able to make asynchronous requests.

This chapter is about structuring Ajax applications. It provides examples of how the well-established Model-View-Controller pattern can be used to provide that structure. In this installment, the authors look at the Controller part of MVC as a way of organizing the event handling code in an Ajax client application, and at the introduction of a domain model into the JavaScript tier of code.

Download the free pdf here.