Learn something new every day
More Info... by email
Reactive programming is a computer science concept that describes the properties of a computer programming language focused on automatically maintaining the state of an application as the data used in the program change. One of the main features of a reactive programming language is that declared and calculated variables are constantly re-evaluated as other variables used in their calculation change. This means the language reacts to the changes in the state of the data, as opposed to using more imperative commands to manage the state, the way many traditional programming languages do. The theoretical result of an application employing reactive programming philosophies would be a program that constantly and automatically changes the display or other factors based on the changing data that is flowing into the program. Although several imperative programming models can be used to achieve the same results as reactive programming, the goal of creating a reactive language would be to have native support for reactive changes at the primitive level, instead of at an object level.
One way to help clarify how reactive programming works is to compare it to imperative programming. When two numbers are added in an imperative language, the result of the addition usually is stored in a given memory location. The operation takes place the moment the command is executed, and the result is decoupled from the two numbers that were added to create the sum. This means that, if either of the two numbers that were added change after the addition takes place, the value of the sum would not change because it already is stored in memory and separate from the original operands.
When a reactive programming language adds two variables to create a sum and one of the two variables changes at some point in the future, then the sum also will change. This implies that a reactive program has the ability to monitor the state of the data being used and to react automatically to changes, potentially changing the overall state of the entire application. There are several models in imperative programming, including event-based programming and observer data models, that can perform the same tasks by creating structures that monitor data changes, but a reactive language would have built-in mechanisms to do this.
The use for a reactive programming language could be in areas in which real-time interpretation of arbitrary data streams is needed. This could include scientific visualization, graphical user interfaces (GUIs), or even real-time communications in which the program is constantly changing based on the data stream being received. It should be noted, however, that there really are no fully implemented, independent reactive programming languages. Most working implementations of the concept take the form of external libraries for more traditional imperative or functional languages.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!