🧰 Developer’s toolbox: 🍾 Singleton Design Pattern

Vee Lesyk
Dots and Spaces
Published in
1 min readAug 6, 2019

Recently, I came across an article written by Eduards Sizovs: STOP LEARNING FRAMEWORKS. It made me think about how many hypes are produced each month with new languages/frameworks, and how many of them are forgotten after one month. They come and go, but some things stay for a very long time. So, I decided to revisit a few topics: design patterns, data structures, sorting/searching algorithms, etc.

For now, I created Developers-toolbox repo, together with the first design pattern: 💍 Singleton implemented in Swift and TypeScript (open for PR of other languages). Ideally, a few months in I will populate it with many examples and interesting use cases.

🍾 Singleton

Ensures a class has only one instance and provides a global point of access to it. Use cases: provide a unified access point to a resource or service that’s shared across an app/service, like an audio channel to play sound effects or a network manager to make HTTP requests.

Github repo: link.

Swift

Singleton Swift.

TypeScript

Singleton TypeScript.
Singleton

P.S. We would be happy to see comments according to mistakes & typos.

--

--

Vee Lesyk
Dots and Spaces

#h+ #livemoredomore Adventurer. Unique experience wizard. Maker of things. Convergence commander. Information warlock. Problem solver. System: ☉; Planet: ♁.