With Learning JavaScript Design Patterns, you’ll learn how to write beautiful, structured, and maintainable JavaScript by applying classical and modern design patterns to the language. If you want to keep your code efficient, more manageable, and up-to-date with the latest best practices, this book is for you.

Explore many popular design patterns, including Modules, Observers, Facades, and Mediators. Learn how modern architectural patterns—such as MVC, MVP, and MVVM—are useful from the perspective of a modern web application developer. This book also walks experienced JavaScript developers through modern module formats, how to namespace code effectively, and other essential topics.

  • Learn the structure of design patterns and how they are written
  • Understand different pattern categories, including creational, structural, and behavioral
  • Walk through more than 20 classical and modern design patterns in JavaScript
  • Use several options for writing modular code—including the Module pattern, Asyncronous Module Definition (AMD), and CommonJS
  • Discover design patterns implemented in the jQuery library
  • Learn popular design patterns for writing maintainable jQuery plug-ins

"This book should be in every JavaScript developer’s hands. It’s the go-to book on JavaScript patterns that will be read and referenced many times in the future."—Andrée Hansson, Lead Front-End Developer, presis!

Addy Osmani

Addy Osmani is a writer, speaker, and a JavaScript developer.He is a member of the jQuery core [Bug Triage/Docs/Learning] teams where helps with bugs, documentation, and developer evangelism.

When not working at AOL his personal OS projects include jQuery UI Bootstrap and TodoMVC, which help developers compare JavaScript MVC frameworks. Addy is the author of the popular ebook, Essential JavaScript Design Patterns. His personal blog is http://addyosmani.com/blog/

  • Introduction
  • What is a Pattern?
  • "Pattern"-ity Testing, Proto-Patterns & The Rule Of Three
  • The Structure Of A Design Pattern
  • Writing Design Patterns
  • Anti-Patterns
  • Categories Of Design Pattern
  • Summary Table Of Design Pattern Categorization
  • JavaScript Design Patterns
    1. Constructor Pattern
    2. Module Pattern
    3. Revealing Module Pattern
    4. Singleton Pattern
    5. Observer Pattern
    6. Mediator Pattern
    7. Prototype Pattern
    8. Command Pattern
    9. Facade Pattern
    10. Factory Pattern
    11. Mixin Pattern
    12. Decorator Pattern
    13. Flyweight Pattern
  • JavaScript MV* Patterns
    1. MVC Pattern
    2. MVP Pattern
    3. MVVM Pattern
  • Modern Modular JavaScript Design Patterns
    1. AMD
    2. CommonJS
    3. ES Harmony
  • Design Patterns In jQuery
    1. Composite Pattern
    2. Adapter Pattern
    3. Facade Pattern
    4. Observer Pattern
    5. Iterator Pattern
    6. Lazy Initialization Pattern
    7. Proxy Pattern
    8. Builder Pattern
  • jQuery Plugin Design Patterns
  • JavaScript Namespacing Patterns
  • Conclusions
  • References