Adds more criticism to Singleton pattern.

This commit is contained in:
Dmitry Avershin 2016-10-18 14:18:47 +02:00
parent eea8785a22
commit b66e8ecef9
2 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,6 @@ improves the performance of application to great extent.
* Violates Interface Segregation Principle (ISP) by providing pattern consumers with an access
to a number of services that they don't potentially need.
* Creates hidden dependencies that can break the clients at runtime.
* Limits object composability by stopping the clients to specify needed dependencies for different objects instantiation.
## Credits

View File

@ -40,6 +40,8 @@ Use the Singleton pattern when
* Violates Single Responsibility Principle (SRP) by controlling their own creation and lifecycle.
* Encourages using a global shared instance which prevents an object and resources used by this object from being deallocated.
* Creates tightly coupled code that is difficult to test.
* Makes it almost impossible to subclass a Singleton.
## Credits