Book Image

Mastering JavaScript Design Patterns

By : Simon Timms
Book Image

Mastering JavaScript Design Patterns

By: Simon Timms

Overview of this book

Table of Contents (5 chapters)

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.