Design patterns in TypeScript: Factory

A Factory hides the details of instantiating objects within a class hierarchy. The client provides some information regarding the object it needs. Based on that information the factory determines which class of objects to instantiate and how to go about it. Factories are typically Singletons but don’t necessarily need to be, and it depends on the implementation needs. Factories is very common. Anytime you are … Continue reading Design patterns in TypeScript: Factory

Singleton

Singletons in TypeScript

A singleton[1] is a pattern that guarantees there is a single instance of an object in the system. A singleton can maintain a state which is shared across the entire system. Singletons abstract their internal workings from the rest of the system. Singletons are common in business applications. They help model real-life business processes that involve shared resources. Singletons in TypeScript In Node.js – and … Continue reading Singletons in TypeScript