The Observer Pattern in PHP 5

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • FluffyCat

    The Observer Pattern in PHP 5

    Last week I continued my series of design patterns examples using PHP
    5. Here now is my 14th example, the Observer pattern.



    In the Observer Pattern, a Subject object notifies an Observer object
    if it's the Subject object's state changes.

    Pretty simple and fairly useful.

    An application for this pattern might be having a Subject object with
    the state of a web page, and an Observer object which can produce RSS
    feeds. If the Subject page changes it notifies the Observer object,
    which produces an RSS feed for the changed page.
Working...