Pro JavaScript Design Patterns by Ross Harmes and Dustin Diaz

About the Book

As a web developer, you'll already know that JavaScript is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked—JavaScript is capable of full object-oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team.

With Pro JavaScript Design Patterns, you'll start with the basics of object-oriented programming in JavaScript applicable to design patterns, including making JavaScript more expressive, inheritance, encapsulation, information hiding, and more. With that covered, you can kick-start your JavaScript development in the second part of the book, where you'll find detail on how to implement and take advantage of several design patterns in JavaScript, including composites, decorators, facades, adapters, and many more.

Each chapter is packed with real-world examples of how the design patterns are best used and expert advice on writing better code, as well as what to watch out for. Along the way you'll discover how to create your own libraries and APIs for even more efficient coding.

  • Master the basics of object-oriented programming in JavaScript, as they apply to design patterns.
  • Apply design patterns to your JavaScript development.
  • Work through several real-world examples.
  • writing an essay

Table of Contents

Part 1: Object-Oriented JavaScript

  1. Ch. 1: Expressive JavaScript
  2. Ch. 2: Interfaces
  3. Ch. 3: Encapsulation and Information Hiding
  4. Ch. 4: Inheritance
  5. Ch. 5: The Singleon Pattern
  6. Ch. 6: Chaining

Part 2: Design Patterns

  1. Ch. 7: The Factory Pattern
  2. Ch. 8: The Bridge Pattern
  3. Ch. 9: The Composite Pattern
  4. Ch. 10: The Facade Pattern
  5. Ch. 11: The Adapter Pattern
  6. Ch. 12: The Decorator Pattern
  7. Ch. 13: The Flyweight Pattern
  8. Ch. 14: The Proxy Pattern
  9. Ch. 15: The Observer Pattern
  10. Ch. 16: The Command Pattern
  11. Ch. 17: The Chain of Responsibility Pattern

About the Authors

works as a frontend engineer for Yahoo! in Sunnyvale, California, where he creates modular and reusable JavaScript components. His technical writings and online projects, such as the YUI Bundle for TextMate, can be found at

is a user interface engineer for Google in Mountain View, California. He enjoys writing JavaScript, CSS, and HTML, as well as making interactive and usable interfaces to inspire passionate users. Dustin has written articles for Vitamin and Digital Web Magazine, and posts regularly about web development at his site, ./with Imagination.

Copyright © 2007 and