Observer Pattern

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

ObserverablePattern

Important point:

  • Subject maintains a collection of objects called observers.
  • When the subject changes, it notifies the observers.

  • Observers can be added or removed from the collection of observers in the subject.

  • The Subject only notifies that its state has changes, it does not pass any information. Observers have to change their own state to reflect the change.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: