Share via


Observer Design Pattern (aka Publish/Subscribe)

This article describes the** Observer design pattern**. This is a behavioral design pattern, a category of design pattern used by software engineers, when writing computer programs.

Introduction

The Observer pattern (also known as Publish/Subscribe pattern) is a design pattern, used in software engineering to allow an object to maintain a list of observers, subscribers or listeners. The object can then notify them of changes, usually by calling their methods or through eventing.

It is defined as a behavioral design pattern, because the program reacts to changes from the observed object.

Benefits

It creates a one-to-many relationship, so one object can maintain a list and easily inform many others of a change of state.

Examples of the pattern

C# has the IObserver<T> Interface to provide notification.

Read more and download the example from here code.msdn.microsoft.com/Dive-into-Observer-Pattern-00fa8573   

Return to Top


See Also

Link to domain parent articles and related articles in TechNet Wiki.

 

Return to Top


Community Resources

These are the external links, including links to Microsoft and TechNet sites that are non-Wiki

 

Return to Top


References section

Use this section if you pulled source material and ideas from other sites, blogs, or forums. Make sure you have permission from authors to use their material.

  • [Please contribute]

 

 

Return to Top


http://c.statcounter.com/8278708/0/13fc676e/1/