Tagged articles
7 articles
Page 1 of 1
Deepin Linux
Deepin Linux
Aug 17, 2025 · Fundamentals

Mastering C++ Singleton: 5 Implementations, Pitfalls & Performance Tips

This article explains why the singleton pattern is essential for global resources in C++, walks through five concrete implementations—from basic lazy and eager versions to thread‑safe double‑checked locking and C++11 static locals—analyzes their performance and resource trade‑offs, and provides a complete printer‑singleton case study with build and run instructions.

CC++11Design Patterns
0 likes · 26 min read
Mastering C++ Singleton: 5 Implementations, Pitfalls & Performance Tips
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 PatternsGo ProgrammingJavaScript Programming
0 likes · 16 min read
Singleton Design Pattern: Implementation and Practical Applications
Su San Talks Tech
Su San Talks Tech
Nov 6, 2021 · Fundamentals

Unlock Cleaner Code: Master 6 Essential Design Patterns for Java Projects

This article introduces six classic design patterns—Strategy, Chain of Responsibility, Template Method, Observer, Factory, and Singleton—explaining their real‑world business scenarios, core principles, and providing clean Java implementations to help developers write more maintainable and extensible code.

Chain of ResponsibilityDesign PatternsFactory Pattern
0 likes · 25 min read
Unlock Cleaner Code: Master 6 Essential Design Patterns for Java Projects
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
MaGe Linux Operations
MaGe Linux Operations
Jun 10, 2019 · Fundamentals

Master Python’s id() and Build a Singleton Pattern

This article explains how Python’s id() function reveals an object’s memory address, demonstrates its output with simple class instances, and guides you through implementing a singleton pattern using __new__ to ensure a class has only one shared instance.

id functionmemory addressobject‑oriented programming
0 likes · 6 min read
Master Python’s id() and Build a Singleton Pattern