Free Chapter: “Coding and Design Patterns” from Stoyan Stefanov’s Object-Oriented JavaScript

By YUI TeamSeptember 26th, 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.

7 Comments

  1. [...] 8 of the Object-Oriented JavaScript is available at the YUIblog.com. [...]

  2. On page 285:
    var obj = {
    function: doSomething() {
    console.log(‘sure, asap’);
    }
    };
    Should probably be:
    var obj = {
    doSomething: function() {
    console.log(‘sure, asap’);
    }
    };

  3. Ha, nice catch, thanks very much, Matt!

  4. [...] YUI blog 那里看到,Stoyan Stefanov (是个牛人,好像Yahoo UED 的就没有不是牛人的) [...]

  5. [...] Free Chapter: “Coding and Design Patterns” from Stoyan Stefanov’s Object-Oriented JavaScript … 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.” (tags: yuiblog.com 2008 mes9 dia2 OOP JavaScript book capítulo_de_livro blog_post) [...]

  6. Thanks for the chapter, I read a lot of it and bookmarked it for reference. Thanks!