Difference between Observer Pattern and Event-Driven Approach

When there is a state change at the Publisher or Subject,

  • Event Driven Architecture (is a message-driven architecture), responsible to deliver message to Subscriber, asynchronously.

  • Observer Pattern (is a software design pattern), responsible to command Subscriber to do something, synchronously.


The Observer Pattern is a very special instance. Event-Driven can mean anything. In most Observer Pattern implementations the Observer is an object watching the observee. When the observee is changed, a method of the observer is called. Strictly speaking this is not an "Event". That means: various different actions on the observee, usually lead to the call of different methods in the observer. The semantics "what" got changed is in the method. In Event Driven Systems, you basically have one consuming object/method and the message what was changed or what happend is in the Event. That can be anything and is not limitd to the idea of observing something! That means: in an Event Driven System you get new semantics by adding new Event types. In an Observer Pattern you usually add semantics by adding a method to the Observer class. HOWEVER: no one is preventing you to implement an Observer as a special listern to ChangeEvents.