Design Patterns in C++: Observer

Design Patterns in C++: Observer

The Observer Pattern is one of the heavily used ones and well, the name says it : It’s purpose is to observe other classes for any updates. To be a bit more exact: you register the Observer classes at the Subject class and when the Subject changes, then all Observers get notified.

So, to be fair, the name is a bit misleading, it should be better called: Notifier Pattern or Subscriber Pattern.

Freeman and Robson are comparing the behavior of this Pattern to a subscription of a newspaper (or a magazine if you want): The subscribers register themselves at the publisher – which means that they give him their addresses. Whenever there is a new edition out, every subscriber gets it delivered.

That’s way more convenient than going to the store every some days, hours or minutes to see if a new one arrived (which is usually called polling).

Unglücklicherweise ist dieser Eintrag noch nicht ganz fertig, bitte habt ein wenig Geduld.

Unfortunately this entry is not yet finished – stay tuned.

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email