Learn Node.js design patterns, Gang of Four, Design patterns

Where did design patterns come from? Many attribute the origin of design patterns in computer science to the book, “Elements of Reusable Object-Oriented Software”.This book was published in 1994. The book had four authors, and these authors are most commonly referred to as the Gang of Four.

The Gang of Four found inspiration in an earlier book called, “A Pattern Language”. In this book, the idea of design patterns applies to construction and civic engineering. The first chapter of Elements of Reusable Object-Oriented Software, defines design patterns using the words of Christopher Alexander, the author of “A Pattern Language”.

Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. Even though Christopher Alexander was referring to civic engineering, software engineering can alsodefine patterns to describe solutions to problems that can be used a million times over. The Gang of Four provided a clear definition of software design patterns, and outlined their required parts. Each pattern must have a name. The name describes the problem, and the solution, in only a couple of words.

The problem must also be clearly stated. It describes when the pattern should be used as well. The solution must be clearly diagrammed and documented, and all design patterns must define consequences or trade-offs, when using them. The Gang of Four patterns refers to the original 23 classic software design patterns that were defined in the book. These patterns were broken into three categories. Creational design patterns have to do with class instantiation, the creation of object instances in our applications. Structural design patterns have to do with the way objects are composed or put together.

Behavioral design patterns define how objects interact with one another. The Gang of Four design patterns were created for object oriented programming languages, and the book included examples written in C++. However, the Gang of Four patterns can be implemented in a number of software languages, included Node.js. Additionally, design patterns are not just limited to object orientation. In fact, JavaScript has design patterns that deal with concurrency and module structure, that were not included in the original Gang of Four design patterns.This is because there are hundreds of design patterns, across many languages and programming paradigms, and new ones are being developed everyday.

In this course, we will also explore some additional patterns that have to do with concurrency, to help us improve the structure of our Node.js applications.

Leave a Reply

Notify of