Learning JavaScript Design Patterns – An Updated Free Book For Developers

Over the past year or so I've been actively trying to encourage more developers to invest time in learning about the benefits of design patterns and how they can be applied to JavaScript. To help with this, I wrote a book on the topic which I released for free.  This week a new version of it is available to read online and includes lots of updates and a few new sections.

The book can be viewed here:

I've had a number of readers get in touch about ePub/Kindle/other formats of the book and I'm currently working on these. Because the content is being updated every week or two, we'll probably need to get a build process in place to automate the book conversion but I'll announce on Twitter as soon as formats can be downloaded.

A Physical Version Of The Book

Update: Version 1.5.x of the book and above are available in either online form to read for free or via O'Reilly if you'd like to pick up physical or eBook formats of the book. The latter is a lot more visually pleasing than the PDF/eBooks I used to generate and I hope this combination of free or purchase options satisfies most readers needs. 

The really smart folks over at O'Reilly Media have been talking to me over the past few months and I'm happy to say that Learning JavaScript Design Patterns is going to be one of the physical books I release this year. Something we're doing a little differently with the books I write for O'Reilly is that we're keeping them completely free and open-source so anyone can grab the latest copy online at any time. You'll also have the chance to support the book and future updates via a paid version in the future if you would like.


One thing I hope comes out of this is that if anyone in the community notices a section of the book that could be improved (whether it be a typo, a grammatical issue or just something that could be done better) all I ask is that you let me know so that I can address it for a future version. I'm more than happy to accept feedback via the comments below or via the issue tracker on GitHub.


That's it. I hope that the book comes in useful and helps encourage you to explore the wonderful world of design patterns just a little bit further. Again, feedback is always welcome and appreciated!.


  1. Great, thanks Addy!

    One tiny mistake I spotted… under “The Structure Of A Design Pattern” – the Illustrations bullet point has two closing brackets, “(eg. a diagram))”

  2. “When creating an application, a project’s life-cycle begins with construction however once you’ve got the initial release done, it needs to be maintained.”

    Needs some form of punctuation before the “however”, probably a comma.

  3. Not time to digg in it yet, but surely i’ll start this weekend. Like i told you on Twitter, i used Send to Kindle and it worked preety good. Ir doesn’t have an index and it’s not perfect, but i thik it could do the work instead of having to convert the book to Kindle format.
    I can’t wait to read the new things in this update. Thanks a lot for this

  4. Hi,
    this is a great Book, I am just digging through the examples.

    What struck me though was the extend() function for ObserverList. It seems it does the complete opposite, that is extending the extension with the original object? Could you check on that?

    Then, the function indexOf() of ObeserverList seems to create an infinite loop (doesnt change the value of i)?

    And in the same “class” the function removeAt() just checks for the beginning or end of the list, but would not remove any entries in between. So i could not do ObserverList.removeAt(3) for example.

    Best regards!

    • Also the function removeAt() from the ObserverList prototype is later (in the Subject code) called removeIndexAt().

    • Hey Frank,

      I noticed that you posted these issues on the project repo, so I’ll chase them up there :)

      Thanks for raising the issue!


  5. Hi Addy,
    In Early Release of this book, you have mentioned that the below code is a Singleton.

    var mySingleton = function () {
    // here are our private methods and variables
    var privateVariable = ‘something private';
    function showPrivate() {
    // public variables and methods (which can access
    // private variables and methods )
    return {
    publicMethod: function () {
    publicVar: ‘the public can see this!’

    var single = mySingleton();
    single.publicMethod(); // logs ‘something private’

    But i feel it is not a singleton as you could create one more instance using the new Keyword, like this,

    var double = new mySingleton();

    Is that a bug in Early release of your book, or, am i missing something?

Leave a Reply

Required fields are marked *.