mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-05-21 14:00:07 +02:00
mark Singleton as an anti-pattern (#31)
This commit is contained in:
parent
d4e74ce175
commit
c71d715a65
@ -5,6 +5,10 @@ namespace DesignPatterns;
|
|||||||
/**
|
/**
|
||||||
* Multiton pattern
|
* Multiton pattern
|
||||||
*
|
*
|
||||||
|
* --------------------------------------------------------------------------------------------------------------
|
||||||
|
* THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!
|
||||||
|
* --------------------------------------------------------------------------------------------------------------
|
||||||
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* to have only a list of named instances that are used, like a singleton but with n instances
|
* to have only a list of named instances that are used, like a singleton but with n instances
|
||||||
*
|
*
|
||||||
|
@ -5,6 +5,10 @@ namespace DesignPatterns\Singleton;
|
|||||||
/**
|
/**
|
||||||
* Singleton pattern
|
* Singleton pattern
|
||||||
*
|
*
|
||||||
|
* --------------------------------------------------------------------------------------------------------------
|
||||||
|
* THIS IS CONSIDERED TO BE AN ANTI-PATTERN! FOR BETTER TESTABILITY AND MAINTAINABILITY USE DEPENDENCY INJECTION!
|
||||||
|
* --------------------------------------------------------------------------------------------------------------
|
||||||
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* to have only one instance of this object in the application that will handle all calls
|
* to have only one instance of this object in the application that will handle all calls
|
||||||
*
|
*
|
||||||
@ -12,7 +16,6 @@ namespace DesignPatterns\Singleton;
|
|||||||
* - DB Connector
|
* - DB Connector
|
||||||
* - Logger (may also be a Multiton if there are many log files for several purposes)
|
* - Logger (may also be a Multiton if there are many log files for several purposes)
|
||||||
* - Lock file for the application (there is only one in the filesystem ...)
|
* - Lock file for the application (there is only one in the filesystem ...)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class Singleton
|
class Singleton
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user