Series: JavaScript design patterns

JavaScript

JavaScript design patterns #1. Singleton and the Module

This entry is part 1 of 5 in the JavaScript design patterns

While having a vibe of a mad genius might be tempting, reinventing the wheel is usually not the best way to approach designing your software. The chances are that somebody already had the same problem as you and solved it in a smart way. Such best practices, when formalized, are called design patterns. Today we look into […]

JavaScript

JavaScript design patterns #2. Factories and their implementation in TypeScript

This entry is part 2 of 5 in the JavaScript design patterns

As discussed in the previous part of this series, there are many design patterns out there. Some of them fit well into the JavaScript language, and they are often used. In this article, we discuss the factory method pattern and show some of its use-cases. We also implement it in TypeScript. There seems to some confusion regarding […]

JavaScript React

JavaScript design patterns #3. The Facade pattern and applying it to React Hooks

This entry is part 3 of 5 in the JavaScript design patterns

The essential thing when approaching design patterns is to utilize them in a way that improves our codebase. The above means that we sometimes can bend them to fit our needs. The Facade design pattern is commonly associated with object-oriented programming. That doesn’t change the fact that we can take its fundamentals and apply them […]

Express JavaScript

JavaScript design patterns #4. Decorators and their implementation in TypeScript

This entry is part 4 of 5 in the JavaScript design patterns

When we are cold, we put on a shirt. If that’s not enough, we put a coat on top. Decorators work similarly. In this article, we discuss the principles of the decorator design pattern and talk about their implementation in TypeScript. We also briefly mention the JavaScript implementation of decorators using Babel. The basics of […]