Reactive programming in simple words – experts explain
The concept of reactive programming is closely related to the concept of a data distribution model, which is of two types:
- pull model.
- push model.
In fact, these models are quite logical and natural, so their manifestations can be traced even in everyday life.
Let’s say Vasya likes to keep abreast of all the news on hockey and therefore periodically visits thematic sites in the hope of discovering interesting content.
His colleague, Petya, is also interested in hockey, but unlike Vasya, Petya subscribed to the newsletter and receives notifications about important events in hockey.
From a programming point of view, Vasya uses a pull model: he periodically looks at data sources, while Petya uses a push model: he deals with incoming messages.
Thus, reactive programming is a style of coding that simplifies the implementation of push-based applications.
In practice, this style is used to process the incoming data stream, for example:
- messages from users;
- schedule change notifications;
- user actions with the interface, etc.