Search code examples
design-patternsobserver-patternsystem.reactive

What is the difference between the Observer and Subject-Observer patterns


While watching some videos on Channel 9 about the Reactive Extensions for .NET, someone asked whether the Reactive Extensions library is an implementation of the Observer pattern. The presenter then went on to answer by saying that the library is an implementation of the Subject Observer pattern. This leads me to believe that there is possibly a difference between the two patterns.

Is there a difference between these two patterns? If so, what is the difference. Links to articles will be helpful too.


Solution

  • From the GoF book, the Observer pattern is illustrated by using Subject and Observer. The Subject holds a list of Observers and notifies them of any state change (usually by calling their "notify" method).

    I wouldn't know what they would be talking about but that's basically it.

    Wiki on Observer Pattern.