Skip to content

Instantly share code, notes, and snippets.

Created January 15, 2014 03:08
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.
Copy link

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.

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