
TypeScript 4 Design Patterns and Best Practices
By :

When developing applications, you design and manage objects all the time. You create them on the fly or when you assign them to variables for later use. If left unnoticed, you can make the code brittle either by having lots and lots of alternative ways to create those objects, or by not managing their lifetime correctly, thus having to deal with memory leaks.
The first and most used category of patterns we will explore in detail in this chapter is creational design patterns.
You start by learning how the Singleton pattern can help to ensure we merely keep one instance of an object throughout the lifetime of the program. By using the Prototype pattern, you can copy existing objects without going back through the process of creating them from scratch.
Using the Builder pattern, you will learn how to break apart the construction flow of complex objects by using a different and more readable representation.
Next, you continue comprehending...