Skip to main content

Observer design pattern

Greetings!

Observer design pattern falls into behavioral category.
This is useful when multiple objects(observers) needs to be updated according to another object's changes(subject).

Subject and observers are loosely coupled and have no knowledge of each other.

Subject(one) -> Observer(many)

"Define a one-to-many dependency between objects so that when one object changes state, all its dependencies are notified and updated automatically."



Image source wikipedia


  • Strive for loosely coupled designs between objects that interact.

Comments