Reactive Programming and the Reactive Manifesto

Extensions

Event-driven systems are easier to extend: the developer only needs to introduce new events and let the corresponding components respond to them appropriately. According to the manifesto, a reactive application must respond flexibly and scalably to additional loads. If the existing computing power is no longer sufficient, the program must be able to harness more computing nodes, and it must drop them again when the load drops (scale in or out).

If a new computing node with several processor cores or new features are added, the application must be able to leverage these resources (scale up or down). In other words, the application must be capable of adapting to its environment – automatically in an ideal world.

Making your own application elastic seems simple to the manifesto authors: Because the components of the application are only allowed to communicate with each other via events, it would not matter on which compute node a component actually runs (location transparency) – especially if the components are only loosely coupled and run as independently as possible.

The intent is for communication to avoid implementing the known RPC mechanisms. Instead, the authors of the manifesto want to "embrace the network" by representing it directly in the programming model as an asynchronous message exchange.

The authors do not say how exactly this will happen. But, they say, it is important to have the right tools at hand to encapsulate the building blocks for solving typical problems that commonly occur in distributed systems. (Anyone who has ever dealt with distributed systems will probably be raising an eyebrow right now.)

Indestructible

A reactive application must respond to malfunctions and errors. According to the manifest, the application should be able to restore or repair itself, along with the data. For this purpose, the defects or faults must be isolated and parts of the application must be monitored. The manifesto proposes the Bulkhead pattern [10] for this purpose. Like the bulkheads on a cargo vessel separating the parts of the ship, these bulkheads break down the program into individual compartments. The idea is that the failure of one compartment does not take down the others. According to the manifesto, an event-driven model helps with this scenario: If one of the independent components fails, it can easily be restarted or replaced with a clone.

Fast

A reactive application must always respond immediately to a user, regardless of the computational load. A fast response gives users the feeling of solving a task more quickly. According to the manifest, the application should achieve this responsiveness by means of observable models, event streams, and stateful clients.

Observable models, says the manifesto, simply mean using the Observer design pattern: Special components notify other components in case of state changes. For example, if the database updates an address, all clients receive a message about this change. These messages run through special channels, known as event streams. Access to these streams is asynchronous.

Data is simply asynchronously dispatched events. However, the manifest does not address feedback. If a value changes, the application does not recompute all the dependent values. The program only needs to inform the affected components if a value changes.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Brightside and Devil’s Pie

    If the no-frills Metacity window manager doesn’t give you the functio nality you need, try the Metacity add-ons Brightside and Devil’s Pie.

  • Meteor

    The Meteor web framework lets you do all your programming in JavaScript – and it includes some useful features for rapid development.

  • Gnome Recipes

    Cutting recipes out of magazines and attaching them to the fridge is a thing of the past. Today, Gnome Recipes is your friendly kitchen helper.

  • Udev

    After three years of hanging around on the sidelines, Udev has finally ousted the legacy Dev-FS system. We take a look under the hood at the Udev device management system inside your Linux system.

  • Desktop Tools: Slax

    With its novel package manager, Slax makes it simple to install new software and easy to build your own distributions.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News