Tag

Singleton Pattern

0 views collected around this technical thread.

Baidu Geek Talk
Baidu Geek Talk
May 19, 2022 · Fundamentals

Singleton Design Pattern: Implementation and Practical Applications

The Singleton design pattern guarantees a single, globally accessible instance, reducing memory overhead and global variables, with eager (init) and lazy (sync.Once) thread‑safe implementations in Go, and practical uses such as configuration management in Python, shared DB connections in PHP, and UI components like toasts in JavaScript.

Design PatternsJavaScript ProgrammingObject-Oriented Programming
0 likes · 16 min read
Singleton Design Pattern: Implementation and Practical Applications
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 29, 2021 · Fundamentals

Understanding the Singleton Pattern: Definition, Nine Implementations, Pros & Cons, and Android Applications

This article explains the Singleton design pattern, its core concept of ensuring a single instance, presents nine Java implementations with code examples, compares their advantages and disadvantages, discusses real‑world usage in Android and general development, and offers guidelines for when to apply the pattern.

AndroidDesign PatternsJava
0 likes · 15 min read
Understanding the Singleton Pattern: Definition, Nine Implementations, Pros & Cons, and Android Applications
Top Architect
Top Architect
Aug 26, 2020 · Fundamentals

Understanding the Singleton Pattern in Java: Five Implementations, Tests, and Their Pros & Cons

This article explains the Singleton design pattern, presents five Java implementations (eager, lazy, synchronized, double‑checked locking, static inner‑class, and enum), compares their advantages and disadvantages, and provides multithreaded test code to demonstrate thread‑safety and resource usage.

Design PatternsJavaJava Concurrency
0 likes · 12 min read
Understanding the Singleton Pattern in Java: Five Implementations, Tests, and Their Pros & Cons