• Mastering JavaScript Design Patterns

Discover how to use JavaScript design patterns to create powerful applications with reliable and maintainable code.


Applying design patterns to JavaScript code creates more reliable and maintainable code. In this book, you will explore different design patterns and learn where and how to implement them with the help of detailed examples.

In the first part of the book, we start off with an introduction to design patterns, and then move on to creating classical structures that are used to organize code. Next, we look at the creational, structural, and behavioral patterns. The second part of the book dives into patterns used for functional programming, model view patterns, patterns to build web applications, and messaging patterns. A number of very interesting advanced JavaScript patterns such as dependency injection and live post-processing are also covered.

By the end of this book, you will learn to identify places where a pattern would improve code readability and maintainability.

What this book covers

This book is divided into two main parts, each of which contains a number of chapters. The first part of the book, which I'm calling Part 1, covers the classical design patterns, which are found in the GoF book. Part 2 looks at patterns, which are either not covered in the GoF book or the ones that are more specific to JavaScript.

Chapter 1, Designing for Fun and Profit, provides an introduction to what design patterns are and why we are interested in using design patterns. We will also talk about the history of JavaScript to give a historical context.

Chapter 2, Organizing Code, explains how to create the classical structures used to organize code: namespaces or modules and classes as JavaScript lack these constructs as first class citizens.

Chapter 3, Creational Patterns, covers the creational patterns outlined in the Gang of Four book. We'll discuss how these patterns apply to JavaScript, as opposed to the languages which were popular at the time when the Gang of Four wrote their book.

Chapter 4, Structural Patterns, examines the structural patterns from the Gang of Four book following on our look at creational patterns.

Chapter 5, Behavioral Patterns, covers the final set of patterns from the Gang of Four book that we'll examine. These patterns govern different ways to link classes together.


Chapter 6, Functional Programming, explains some of the patterns which can be found in functional programming languages. We'll look at how these patterns can be used in JavaScript to improve code.

Chapter 7, Model View Patterns, examines the confusing variety of different patterns to create single-page applications. We'll provide clarity and look at how to use libraries which use each of the existing patterns, as well as create their own lightweight framework.

Chapter 8, Web Patterns, covers a number of patterns which have specific applicability to web applications. We'll also look at some patterns around deploying code to remote runtimes such as the browser.

Chapter 9, Messaging Patterns, explains messaging which is a powerful technique to communicate inside, and even between, applications. We'll also look at some common structures around messaging and discuss why messaging is so useful.

Chapter 10, Patterns for Testing, focuses on some patterns which make for easier testing, giving you more confidence that your application is working as it should.

Chapter 11, Advanced Patterns, includes some patterns, such as aspect-oriented programming, that are rarely applied in JavaScript. We'll look at how these patterns can be applied in JavaScript and discuss if we should apply them.

Chapter 12, ES6 Solutions Today, discusses some of the tools available to allow you to use features from future versions of JavaScript today. We'll examine Microsoft's TypeScript as well as Traceur.

Appendix, Conclusion, covers what you have learned, in general, in the book, and you will be reminded of the goal of using patterns.


Author: Simon Timms


Write a review

Note: HTML is not translated!
    Bad           Good

Mastering JavaScript Design Patterns

  • Product Code: JavaScript
  • Availability: In Stock
  • $25.00
  • $15.00

  • Ex Tax: $15.00

Tags: Mastering JavaScript Design Patterns