Behavioral

Observer

Description

Lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they're observing.

Where to use

  • Event handling systems.
  • \n
  • UI Updates.

Real World Example

A Spreadsheet. If you change value in Cell A1, the Chart observing A1 automatically updates.

Code Example

class Observer:\n    def __init__(self):\n        pass\n\n    def execute(self):\n        print('Executing Observer')