O'Reilly logo

C++ Reactive Programming by Peter Abraham, Praseed Pai

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reversing the gaze for Observables!

We have already learned that we can transform a composite to a list and traverse them through an Iterator. The Iterator pattern pulls data from the data source and manipulates the result at the consumer level. The most important problem we face is that we are coupling our EventSource and event sink. The GoF Observer pattern also does not help here.

Let's write a class that can act as an event hub, which the sinks will subscribe to. By having an event hub, we will now have an object that will act as an intermediary between the EventSource and event sink. One advantage of this indirection is readily obvious from the fact that our class can aggregate, transform, and filter out events before they reach the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required