mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-05-15 19:10:45 +02:00
adding comments
This commit is contained in:
parent
d2e86f1c35
commit
a3648c449e
@ -15,8 +15,9 @@ use DesignPatterns\Mediator\Subsystem;
|
|||||||
* It is a good alternative over Observer IF you have a "central intelligence",
|
* It is a good alternative over Observer IF you have a "central intelligence",
|
||||||
* like a controller (but not in the sense of the MVC).
|
* like a controller (but not in the sense of the MVC).
|
||||||
*
|
*
|
||||||
* All objects (called Colleague) are coupled only to the MediatorInterface and
|
* All components (called Colleague) are only coupled to the MediatorInterface and
|
||||||
* it is a good thing because in OOP, one good friend is better than many unreliable.
|
* it is a good thing because in OOP, one good friend is better than many. This
|
||||||
|
* is the key-feature of this pattern.
|
||||||
*
|
*
|
||||||
* In this example, I have made a "Hello World" with the Mediator Pattern, have fun (^_^)
|
* In this example, I have made a "Hello World" with the Mediator Pattern, have fun (^_^)
|
||||||
*/
|
*/
|
||||||
|
@ -23,4 +23,4 @@ Changes I've made :
|
|||||||
* Fixing the Adapter Pattern because it was buggy and incomplete (+ Tests)
|
* Fixing the Adapter Pattern because it was buggy and incomplete (+ Tests)
|
||||||
* Adding Template Method Pattern (+ Tests)
|
* Adding Template Method Pattern (+ Tests)
|
||||||
* Adding Builder Pattern (+ Tests)
|
* Adding Builder Pattern (+ Tests)
|
||||||
*
|
* Adding Mediator Pattern (+ Tests)
|
@ -30,7 +30,10 @@ class MediatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
// testing if Hello World is output :
|
// testing if Hello World is output :
|
||||||
$this->expectOutputString('Hello World');
|
$this->expectOutputString('Hello World');
|
||||||
|
// as you see, the 3 components Client, Server and Database are totally decoupled
|
||||||
$this->client->request();
|
$this->client->request();
|
||||||
|
// Anyway, it remains complexity in the Mediator that's why the pattern
|
||||||
|
// Observer is preferable in mnay situations.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user