Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
References for Why Not to Use Singleton Design Pattern Google's Clean Code Talks ("You should be wary when using the singleton pattern, as by its very nature it introduces global state into your application, reducing testability.") ("The Singleton Pattern is perhaps the most well known - and most often misused - pattern in all of PHP design pattern development. Its simplicity, combined with its seeming benefits makes it a widely-used (and overused) pattern. The Singleton is not so much a recommended pattern, as a pattern I recommend you shy away from.")
Once you've read all those, read everything abou Dependency Injection, how that helps with injecting mocks during unit testing, and therefore why Singletons are bad.

This comment has been minimized.

Copy link

@schlessera schlessera commented Nov 14, 2016

Why aren't these links clickable? Links that are not clickable are like music without a sound, remaining bleak and lifeless, and forever hiding their true purpose.


This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment