What is Reactive Programming (Reactive Programming)?

Asked

Viewed 21,497 times

43

Can someone explain to me clearly and objectively?

I read some more articles still not very clear.

  • 1

    http://www.reactivemanifesto.org/ http://en.wikipedia.org/wiki/Reactive_programming

  • 3

    This is the best material I’ve ever read on the subject: https://github.com/kriskowal/gtor

1 answer

65


Reactive programming is programming with asynchronous data streams (streams). Asynchronous means that it does not take place at the same time or at the same rate of development (relative to something else).

This is important due to the growth of the Internet and the demand for real time, programming needs to be dynamic, that is; different from the traditional form of development.

The traditional way of programming/developing, for example, creates several tasks and they communicate at certain times, with answers determined without scalability in case of any failure, some greater demand, are "rigid", follow direct rules. This worked and continues to be used until today, however this "logic" is no longer compatible with the current need.

In the traditional method is how to prepare the cement mixture, after it sent the data saying it is prepared, is called the function of building the wall, then the plaster, wait a certain time, after the period is called the function of painting and if the painter lacks? Screwed everything, gave system error! Or if communication fails? Also, system crashes, usually need to redo everything!

In reactive programming this all occurs, but in an intelligent way, interconnected in parallel, without following that chronological and linear order, as for example: the wall is built, lack the plaster, time to dry, then paint. There is no painter, failure in this task, the system will not lock, recognizes that it is possible to continue other parts of the construction in parallel as the floor, put the floor, while waiting for the task of painting, without having to start all over again, then finish the painting, without having been interrupted the system by "error".

That’s the logic, it seems kind of obvious if you think about it, but systems are still not very smart, they need to be properly programmed to be able to manage failures, different routines, follow alternative paths, many accesses, work in real time and always be online/active!

Follow the pillars of reactive programming:

  • Elastic band: Reacts to demand/load: applications can make use of multiple cores and multiple servers;
  • Resilient: Reacts to failures; applications react and recover from
    software, hardware and connectivity failures;
  • Message Driven: Reacts to events (Event driven): instead of composing
    multi-application threads synchronous systems are composed of asynchronous and non-blocking event managers;
  • Responsive: Reacts to users: applications that offer interactions
    rich and "real time" with users.

More details can be found in this video and in that article.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.