Free Chapter: "Coding and Design Patterns" from Stoyan Stefanov's Object-Oriented JavaScript

By YUI TeamSeptember 26, 2008

Stoyan Stefanov's 'Object Oriented JavaScript' [book cover]Stoyan Stefanov is a member of Yahoo's Exceptional Performance team; he's worked on a variety of performance-related projects at Yahoo, including the popular YSlow plugin for Firebug. He's also a contributing author here on YUIBlog.

Stoyan's latest project is Object Oriented JavaScript, a new book from Packt whose simple goal is to help you learn how to "think in JavaScript." Stoyan and his editors were kind enough to let us share with you Chapter 8 from OOJS — "Coding and Design Patterns."

Among the coding patterns explored in this chapter:

  • Separating behavior
  • Namespaces
  • Init-time branching
  • Lazy definition
  • Configuration objects
  • Private variables and methods
  • Privileged methods
  • Private functions as public methods
  • Self-executable functions
  • Chaining
  • JSON

Design patterns include:

  • Singleton
  • Factory
  • Decorator
  • Observer

The sample chapter is an excellent standalone resource, but the full volume is outstanding as well. Our thanks to Stoyan and his editors for allowing us to freely share the coding and design patterns content here.