Preface
We decided to write this book after being frustrated that there was still frustratingly little information available on some of the more advanced topics in AJAX development. This was mainly because people in the industry were still 'writing the book' on some of these topics, and despite a couple years in mainstream use, AJAX was still just creeping into the enterprise software stack. We wanted to create a resource of information that would be of interest to enterprise developers in this space. To that end, we have tried to bring together current development approaches with JavaScript and the other technologies that comprise AJAX, and present it in a way that would be familiar and amenable to any enterprise developer.
WHY DO YOU NEED THIS BOOK?
We've given a considerable amount of time to discussing how to write JavaScript code in a way that should be familiar to Java or C# developers to get you up and running quickly. In doing so we described AJAX development with familiar software design patterns at the forefront of our minds, and included information on some of the hottest topics in AJAX development such as security and offline storage. We also present readers with real solutions to building high performance AJAX applications not just through code optimization but through taking advantage of Internet infrastructure mainstays such as caching.
This book takes slightly different approach than other AJAX books in that we try to present a well rounded discussion one that includes (of course) a lot of advice about programming, but also a fair amount of discussion on issues such as application usability, accessibility and internationalization. It also includes a framework for assessing risk in an AJAX development project and even spotlights some developers in the field using AJAX in real enterprise applications to see what can be learned from their experiences.
Most of this content has been derived from our years of first-hand experience in building AJAX applications and user-interface components over at Nitobi (http://www.nitobi.com). We feel that this represents an excellent cross-section of the knowledge we've acquired during this time, and should serve as a useful resource for any developer hoping to include AJAX in their development projects.
WHO IS THIS BOOK FOR?
Enterprise AJAX has been written with intermediate to advanced server-side developers in mind (be they Java, Object Oriented PHP, or ASP.NET). Many of the concepts in the book have been adopted from the time honoured software engineering patterns introduced by the Gang of Four*, and readers would benefit from a basic understanding of software design patterns, or at least an interest in learning more about them - as they are applied throughout the book. We hope that delivering AJAX in a familiar way using patterns will help the more experienced developer understand the concepts and ideas more easily.
*Design Patterns: Elements of Reusable Object-Oriented Software, Gamma, Helm, Johnson, Vlissides, Addison-Wesley Professional, 0201633612.
Perhaps more important than understanding patterns, readers should ideally have at least a basic knowledge of JavaScript, HTML, and CSS. Even some understanding of XML, XSLT or JSON would be helpful, although not essential. Furthermore, we expect that the reader is experienced with server-side programming in an object oriented language such as Java, C# or PHP.
After reading this book developers should be familiar with the constituent parts that make up the AJAX technology stack and be very familiar with object oriented JavaScript development. Similarly, the reader will have a very good knowledge of the tools available to them to aid them in development AJAX applications and also have good knowledge of various AJAX issues such as security, usability and accessibility.
WHAT'S IN STORE
We begin in Chapter 1 by covering the basics of what an AJAX application is and how the pieces all fit together. There we also discuss the evolution of the web application and some of the reasons that AJAX is becoming the preferred solution for web based applications.
In Chapter 2 we dive right into the AJAX technology stack. This includes critical information about the right way to program JavaScript and we pay special attention to Object Oriented JavaScript development, the Document Object Model, Cascading Stylesheets, Events, the XMLHttpRequest object as well as other issues relating to transferring data from the client to the server.
Chapter 3 builds on Chapter 2 and lays a foundation for understanding the major browser differences and with that knowledge looks at how one can build AJAX applications using the Model-View-Controller design pattern. In particular, we see how to write a client-side Model in JavaScript, how to generate HTML views from data and how to connect the Model and View using a JavaScript based Controller that relies on a publish-subscribe event system.
In Chapter 4 we are ready to look at how one may go about building an AJAX user-interface component for use in a web application. In particular we examine the differences between an imperative and declarative approach and look at some of the caveats of a declarative approach while presenting a complete example of building an AJAX based data-grid component.
At this point in the book we begin looking at some of the overarching goals and problems with AJAX development. Chapter 5 specifically looks at issues throughout the software development lifecycle that are unique to AJAX from application design to testing to deployment. Readers should leave this chapter with a very good idea of various AJAX performance problems as well as many of the tools that are useful from the start to end of any AJAX development project.
Chapter 6 introduces the reader to various architectural issues surrounding AJAX development. This includes investigating asynchronous messaging patterns, approaches to server communication such as server push, caching, scaling, and offline AJAX. While many of these are common to any web-based application we approach these issues with a unique AJAX perspective.
Building on Chapter 6, Chapter 7 discusses how AJAX can fit into a service oriented architecture using Web Services in the web browser as well as the different security problems that can arise when building an AJAX web application.
Chapter 8 starts the final section of the book by exploring some pertinent topics in usability, specifically where they apply to building AJAX applications for everyday users. Of interest in Chapter 8 are complete solutions to common problems such as the back-button problem as well as approaches to addressing accessibility and internationalization.
Chapter 9 is a hands-on exploration of some powerful AJAX user-interface patterns including in-place editing, master-detail, live forms, and drag and drop. These are some of the core user-interface design patterns that developers should be aware of when building almost any AJAX application.
In Chapter 10 we shift gears and explore sources of risk in developing scalable enterprise-grade AJAX applications. This is likely the least explored topic in AJAX books but is equally important to the technology itself when considering building a new application.
To wrap things up, in Chapter 11 we look at some actual AJAX implementations in demanding enterprise environments. We speak to the developers and hear what they did right, wrong, and what they would do differently next time.
All in all, we hope this will give you a new perspective on AJAX development, and most of all that you come away with some new skills to bring to your development projects.