num_pages: 245
description: Most software applications must handle user or system-generated events. The most widely-accepted event handling model is the Observer pattern, in which an object "listens" for changes in the application's state and then reacts by executing a unit of code, such as a method. While commonly used, this approach is prone to bugs related to the calling, registration, and destruction of the methods that observe and respond to events.Functional Reactive Programming (FRP) is an alternative to the Observer pattern that's designed to deal with events as a stream of values over time rather than as a series of unique responses to discrete changes in state. This helps keep your logic tidy and frees you from the bugs that plague event handling code with no loss of expressiveness. FRP is useful anywhere the Observer pattern is common, including user interfaces, video games, networking, and industrial applications.Functional Reactive Programming teaches the concepts and applications of FRP. It begins with a careful walk-through of the FRP core operations and introduces the concepts and techniques you'll need to use FRP in any language. Following easy-to-understand examples, you'll learn both how to use FRP in greenfield applications and how to refactor existing applications. Along the way, the book introduces the basics of functional programming in a just-in-time style, so you never learn anything before you need to use it. When you're finished, you'll be able to use FRP to spend more time adding features and less time fixing problems.
language: English
title: Functional Reactive Programming
publisher: Manning Publications