O'Reilly logo

Learning Python Design Patterns by Gennadiy Zlobin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Observer design pattern

The Observer design pattern tries to facilitate one-to-many relationships in software engineering. There are many situations that deal with one-to-many relationships: several readers subscribe to a blog, several event listeners subscribe to handle mouse clicks on a user interface item, or several phone applications subscribe to receive a notification when they get data from the Internet.

The Observer design pattern is very similar to subscribing to a newspaper in the following aspects:

  • The subscriber opens subscription for the newspaper
  • You subscribe to the newspaper
  • Somebody else subscribes to the newspaper
  • When there's a new newspaper, you and that somebody else get a new newspaper
  • If you don't want to receive the newspaper ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required