Singleton

The Singleton: The Alternatives Monostate Pattern and Dependency Injection

So far, I have discussed in my previous posts the Singleton Pattern, and its pros and cons. One question is still open: What alternatives for the Singleton Pattern are available? Today, I write about the Monostate Pattern and Dependency Injection.

Read more
Views: 8732

The Singleton: Pros and Cons

I introduced in my last post "The Singleton", the classical Singleton and the so-called Meyers Singleton. The Singleton Pattern is highly controversial. Let me, therefore, discuss in this post the pros and cons of the Singleton.

Read more
Tags: Singleton
Views: 9826

The Singleton

The most controversial Design Pattern from the book  "Design Patterns: Elements of Reusable Object-Oriented Software" is the Singleton Pattern. Let me introduce it before I discuss its pros and cons.

Read more
Tags: Singleton
Views: 12637

Thread-Safe Initialization of a Singleton

There are a lot of issues with the singleton pattern. I'm totally aware of that. But the singleton pattern is an ideal use case for a variable, which has only to be initialized in a thread-safe way. From that point on you can use it without synchronization. So in this post, I discuss different ways to initialize a singleton in a multithreading environment. You get the performance numbers and can reason about your uses cases for the thread-safe initialization of a variable.

Read more
Views: 355321

Thread-Safe Initialization of Data

In case the data is not modified when shared between threads, the story is simple. The data has only to be initialized in the thread safe way. It is not necessary to use an expensive lock for each access.

Read more
Views: 96706

Mentoring

Stay Informed about my Mentoring

 

English Books

Course: Modern C++ Concurrency in Practice

Course: C++ Standard Library including C++14 & C++17

Course: Embedded Programming with Modern C++

Course: Generic Programming (Templates)

Course: C++ Fundamentals for Professionals

Interactive Course: The All-in-One Guide to C++20

Subscribe to the newsletter (+ pdf bundle)

All tags

Blog archive

Source Code

Visitors

Today 385

Yesterday 7888

Week 8273

Month 152444

All 11633598

Currently are 166 guests and no members online

Kubik-Rubik Joomla! Extensions

Latest comments