YoVDO

Why I Don't Like Singletons - Drawbacks and Alternatives

Offered By: The Cherno via YouTube

Tags

Software Architecture Courses C++ Courses Object-oriented programming Courses Memory Management Courses Design Patterns Courses Lazy Loading Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the drawbacks of using singletons in software development through this comprehensive video tutorial. Delve into the concept of singletons and their context, examining lazy loading and the reasons why singletons are often considered problematic. Compare singletons to global variables and review Meyers' Singleton implementation. Learn techniques to improve singleton design, including making shutdown explicit, avoiding static storage for instances, and removing lazy loading for explicit initialization. Discover the presenter's solution to the "global" situation and gain insights into alternative approaches for managing shared resources in your code.

Syllabus

- Comments and the Community
- The Comment
- Singletons and Context
- Lazy Loading
- Why are singletons "bad"?
- Having a "global variable" is "better"
- Reviewing Meyers' Singleton
- Improving our singleton to make shutdown explicit
- Not storing our instance in static storage
- Removing lazy loading to make initialization explicit
- The "global" situation - my solution


Taught by

The Cherno

Related Courses

Computer Graphics
University of California, San Diego via edX
Intro to Parallel Programming
Nvidia via Udacity
Initiation à la programmation (en C++)
École Polytechnique Fédérale de Lausanne via Coursera
C++ For C Programmers, Part A
University of California, Santa Cruz via Coursera
Introduction à la programmation orientée objet (en C++)
École Polytechnique Fédérale de Lausanne via Coursera