Design Patterns, Ajax, and Application Supremacy

A sidebar to a recent article in CIO Magazine framed the competition between Microsoft and Google as a competition between .NET and Ajax. Essentially, while Microsoft is banking on integrating familiar desktop applications (like Windows, Word and Excel) with web services via .NET, Google is pushing the envelope of the GUI experience in the browser (with Google Maps, Google Suggest, and elements of Gmail) via Ajax.

The recent limelight Ajax has enjoyed thanks in part to Google’s inspiring use of the technology, combined with the recent announcement of the Zend Framework For PHP, propels the relevance of design patterns in PHP applications forward in a new direction. You see, much of the theory and practice of design patterns has centered around rich desktop applications, requiring only selective use in browser-based applications. With the popularization of Ajax, we may well have leapt over the final hurdle to making web applications feel like rich desktop applications.

The first and most important hurdle was overcoming the stateless nature of http, which we accomplished (admittedly, while introducing new security considerations) via sessions. The second and equally important hurdle has been the less-than-snappy nature of GET and POST operations to interact with the user. By introducing more real-time client-side JavaScript operations and coupling them with a rich server-side feature set via Ajax, the possibility now exists for web applications to compete more effectively with rich desktop applications. Finally, with PHP five’s strengthened object model, even the more advanced topics within the discipline of design patterns may now apply.

The keen interest of numerous industries to realize a consistent application framework via the Zend Framework For PHP only strengthens the argument toward best practices and enterprise standards for PHP applications. Such standards and practices could propel PHP into the foreground of the battle between desktop applications and browser applications, .NET and Ajax, Microsoft and Google. So, in part II of my two-part series on design patterns in PHP for International PHP Magazine (now on its way to the editors), we will examine the decorator, strategy, and observer patterns with an eye toward how design patterns can improve the desktop-like feel of Ajax applications — bringing you to the front lines of the battle for rich, powerful, enterprise-class web applications.

Categories: PHP.