Why Singleton Is Usually a Trap

A Singleton fixes two copies that disagree, but it hides what a class needs and lets tests change each other's results; making one object at the start of the app and handing it in keeps one shared object without either problem.

By

Updated

Cheat sheet: Why Singleton Is Usually a Trap
Category
Data Structures
Level
Journeyman
Tags
Dependency Injection, Hidden Dependency, OOP, Singleton Pattern