Retiring the Singleton Pattern: Concrete Suggestions for What to use Instead - Peter Muldoon

Published: 01 January 1970
on channel: CppCon
41,866
709

https://cppcon.org/
https://github.com/CppCon/CppCon2020/...
---
“The worst part of this whole topic is that the people who hate singletons rarely give concrete suggestions for what to use instead.” - stackoverflow

In this talk, we will explore just such an approach that will transform currently untestable code containing underlying singletons with a fully testable solution. These code changes are transparent to the original callers of that function so no calling code changes are required.

This approach will be further expanded to handle multiple interdependent singletons. The replacement of error prone specific order of initialization calls to the singletons will be exchanged for "hard to misuse" automatic initialization using features of the language.

A host of other potential real world problems with replacing singletons are shown with solutions presented for both legacy and modern C++.

This alternative approach has been successfully employed in multiple areas in Bloomberg where developers believed there was no other feasible choice.

---
Peter Muldoon
Bloomberg
Senior developer
NYC

---
Streamed & Edited by Digital Medium Ltd - events.digital-medium.co.uk
[email protected]

*-----*
Register Now For CppCon 2022: https://cppcon.org/registration/
*-----*


Watch video Retiring the Singleton Pattern: Concrete Suggestions for What to use Instead - Peter Muldoon online, duration hours minute second in high quality that is uploaded to the channel CppCon 01 January 1970. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 41,866 times and liked it 709 visitors.