filmov
tv
Singleton Pattern - Design Patterns in JavaScript
Показать описание
The singleton pattern limits the instantiation of an object to a single instance, helps coordinate data, and functions across the application, and can help to reduce unnecessary memory usage.
0:00 Intro
1:46 Simple example
5:52 Realistic example with a classe
8:56 Realistic example with a function
11:50 Outro
Why not use singletons?
* May introduce unnecessary restrictions
* Singletons are available anywhere in the application by anything, which may mean that dependencies may not be immediately visible, meaning developers may need to know the inner workings of the singleton
* It May be difficult to test
Requirements
* Ensure that only one instance of the singleton exists
* Provide global access to the instance
Examples
* Logging function - Don't want a new instance of the logger for every log
* Global config - Config should come from a single source of truth
* Database connections - Many instances can increase memory usage
Video structure
* Simple example
* Database connection example with a class
* Database connection example with a function
🌎 Follow me here:
Singleton Pattern - Design Patterns
The Singleton Pattern Explained and Implemented in Java | Creational Design Patterns | Geekific
Singleton Pattern – Design Patterns (ep 6)
What is Singleton Class in Java | Singleton Design Pattern Part 1
What is the Singleton Pattern? (Software Design Patterns)
8 Design Patterns EVERY Developer Should Know
The Singleton Design Pattern - Part of the Gang of Four
Softwareengineering Tutorial #30 - Das Singleton
3 Design Patterns, die Softwareentwickler kennen sollten
Design Patterns: Singleton
What is Singleton Pattern in Java - How to achieve this?
Singleton Design Pattern in C# - Do it THAT way
Singleton Design Pattern | Implementation with details & code ✌🏻
Singleton pattern - design patterns (ep 7)
Singleton Design Pattern
Javascript Design Patterns #2 - Singleton Pattern
DESIGN PATTERN IN JAVA: SINGLETON PATTERN [ITALIANO]
5 Design Patterns That Are ACTUALLY Used By Developers
SINGLETONS in C++
27. All Creational Design Patterns | Prototype, Singleton, Factory, AbstractFactory, Builder Pattern
Singleton Design Pattern Tutorial
Singleton Design Pattern - Advanced Python Tutorial #9
Singleton Pattern - Design Patterns in JavaScript
Learning Programming Design Patterns
Комментарии