The Observer pattern – advantages and disadvantages

The Observer pattern provides you with the following advantages:

  • It supports the principle of loose coupling between objects that interact with each other
  • It allows sending data to other objects effectively without any change in the Subject or Observer classes
  • Observers can be added/removed at any point in time

The following are the disadvantages of the Observer pattern:

  • The Observer interface has to be implemented by ConcreteObserver, which involves inheritance. There is no option for composition, as the Observer interface can be instantiated.
  • If not correctly implemented, the Observer can add complexity and lead to inadvertent performance issues.
  • In software application, notifications can, at times, ...

Get Learning Python Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.