README Observer

This commit is contained in:
Dominik Liebler
2013-09-24 13:44:11 +02:00
parent 722218f1a2
commit 5633c8508c
2 changed files with 15 additions and 11 deletions

14
Observer/README.md Normal file
View File

@@ -0,0 +1,14 @@
# Observer
## Purpose
To implement a publish/subscribe behaviour to an object, whenever a "Subject" object changes it's state, the attached
"Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead.
## Examples
* a message queue system is observed to show the progress of a job in a GUI
## Note
PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject.

View File

@@ -3,17 +3,7 @@
namespace DesignPatterns\Observer;
/**
* Observer pattern
*
* Purpose:
* to implement a publish/subscribe behaviour to an object, whenever a "Subject" object changes it's state, the attached
* "Observers" will be notified. It is used to shorten the amount of coupled objects and uses loose coupling instead
*
* Examples:
* - a message queue system is observed to show the progress of a job in a GUI
*
* PHP already defines two interfaces that can help to implement this pattern: SplObserver and SplSubject
*
* class UserObserver
*/
class UserObserver implements \SplObserver
{