Observer Design Pattern

  1. The Observer :

Is a software design pattern in which an object, called the Subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes by calling one of their methods.

The observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Another name of Observer is listener.

Design pattern observer

                               Figure : Diagramme UML du Observer pattern.

Example code source :

Add a comment