Jump to ratings and reviews
Rate this book

Functional Reactive Programming

Rate this book
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.

245 pages, ebook

First published January 1, 2015

9 people are currently reading
155 people want to read

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
9 (21%)
4 stars
19 (45%)
3 stars
9 (21%)
2 stars
3 (7%)
1 star
2 (4%)
Displaying 1 - 7 of 7 reviews
Profile Image for Sebastian Gebski.
1,188 reviews1,340 followers
September 16, 2016
Functional (yes, this word is crucial here) Reactive Programming described in a bit different way than usually - all the examples that illustrate FRP (and of course there are plenty of them) are based on Sodium: library that isn't really that popular, but according to author - it's far more "canonical" in terms of FRP. Sadly sometimes I couldn't get rid of the feeling that book is more about library than FRP paradigm ... ;/

Personally I'm more interested in the concept itself than in this current implementation - actually Sodium seems rather opinionated & its FRP model introduces some specific terms & nomenclature -> it's doesn't really help, but author has put some effort to clarify how do these specific terms correspond to what's present in alternative solutions.

Unfortunately, code samples are in Java - it's not a bad language, but they are really verbose, especially with Swing-specific code constructs: this makes them really annoying sometimes.

I like how author has tried to present what happens with code when complexity increases - in FSM, FRP & callback-style code. That was actually really beneficial & partially compensated limited perspective on FRP drawbacks in general.

Wrapping up: if you're really interested in FRP, this book presents quite unique perspective, but what you'll learn isn't necessarily directly applicable.
Profile Image for Julio Biason.
199 reviews28 followers
March 4, 2020
(-) Some phrase constructions are a bit hard to read. Maybe it's because I'm not a native English speaker, but some phrases are akin to "my beautiful nature photos", which you can read in different ways ("my beautiful photos of nature", "my photos of beautiful nature") and I had to backtrack and read the whole thing again.
(-) Code is a mess. Long listings with no separation of concerns. I mean, ok, you can use lambdas for simpler functions, but when you keep piling lambdas over lambdas, things get a bit out of hand. Trying to explain some functionality in a 200 line function is not actually helpful.
(-) The ePub version seriously need another check. Some code listings are pure text, so it follows the user font size; but other are screenshots/images of code, which get way out of hand, as some listings had fonts that where 1/5 of the font I use to read (yes, I use a large font, I'm reading at night without my glasses, but the point remains).
(--) There is very little explanation on what FRP really is, but a lot about how to do things with Sodium, the authors library. Instead of focusing on how to build your own FRP system, using Sodium as reference, the books focuses a lot in using Sodium and why that implementation is FRP instead of explaining the concept behind the FRP functionality itself.
(--) The authors shows some weird prejudices against TDD. For example, they say that FRP doesn't require TDD and that using TDD is actually harmful for FRP, "unless you test logic". I mean, seriously? What do you think TDD is about? Lines of code? TDD says that "tests should validate behaviors, not implementation" and I'm wondering why the authors are so reticent against TDD when their concept of TDD seems completely out of place.
(---) There is a strong gatekeeping in the book. While talking about other frameworks, the authors, they decide to focus more on "why this framework is not pure FRP, while Sodium is" instead of, again, focusing on the concepts of FRP itself. "FRP says so and so, you can build this with framework X using that and that" is a good way to do it; "FRP says so and so, framework X do this which is not what the FRP says, so framework X is not FRP, but Sodium is!" is a dickish way to downplay other frameworks. Also, it's weird that every time Sodium breaks some FRP rule (rules that the authors themselves keep listing), they put a long explanation on why it's ok to break the rule there, saying that it's ok that Sodium breaks it.

Honestly, I read the book and I still don't understand FRP; all I got was some concepts for a Sodium framework.
5 reviews
June 12, 2019
I had a very hard time going through this book despite having used RxSwift for quite a while, and I'm comfortable developing with it. I did learn a bit more about reactive systems, but I didn't get much practical out of the book. My favorite chapter was #7 "FRP on the web", one of the few sections where it's used in some practical sense.

It focuses too much on what "pure" FRP is. Add a lot of jargon on top of that and you have a very dense, hard to read book.
Profile Image for Stijn.
Author 9 books8 followers
October 17, 2017
Nice way of explaining to non-functional programmers what Functional Reactive Programming is all about!
81 reviews
October 21, 2022
Intro with some examples to functional reactive programming. It is an abstraction that they've created inside java. The book is ok, maybe I'd enjoy more if I had done the samples.
Profile Image for Fabian.
16 reviews4 followers
January 2, 2017
An excellent reference about FRP. It covers the reasons and benefits of using FRP, exposes the internals of FRP systems, and illustrate pitfalls and useful patterns.

It’s something fundamental: we think that anyone who tries to solve the prob-
lems in the observer pattern will eventually invent FRP.

When building highly interactive real-time data UIs, I have been converging more and more toward some FRP like solutions, finally found about FRP and made the switch. While I have been using another library and language than the one described in the book, I found the examples very useful and relatable.
102 reviews
October 23, 2016
A brilliant and witty book.

You can't always make everyone happy, as the examples are in Java and it uses a specific (although canonical) FRP library sodium as a reference.

Having said that, these are rather secondary , most of the FRP systems follow the same conventions and rules using just different keywords (for instance, Rx uses Observable, whereas Sodium would have Cell). Examples and understanding of FRP is the key in this case, and Stephen does it all too well.

Great read & book about FRP whatsoever.
Displaying 1 - 7 of 7 reviews

Can't find what you're looking for?

Get help and learn more about the design.