Tag Archives: BaconJS

Video: Functional Reactive Programming with JQuery, Flight and Bacon.js

Keeping frontend code cleanly decoupled is challenging at the best of times. Rich user interfaces often depend on complex interactions between program state, control values, and AJAX requests, which makes it hard to write correct and testable code.

One technique for handling this complexity that is gaining favor in some circles is Functional Reactive Programming, which provides powerful tools for manipulating and composing streams of events and values that change over time.

Using the working example of a simple Flight mobile web app, this talk will introduce the fundamentals of functional reactive programming and show how it can greatly simplify complicated UI logic.

Video: An introduction to functional reactive programming with Bacon.js

Trying to deal with realtime data and user interaction in the browser with callback after callback after callback quickly leads to madness. This is because application state is being modified all over the place by different callbacks, which makes applications complex and hard to reason about.

Functional reactive programming is a powerful concept borrowed from Haskell that makes events much easier (and fun!) to work with, by turning them into event streams which can be mapped, merged, filtered and more. Bacon.js (https://github.com/raimohanska/b…) by Juha Paananen is a lovely little library that implements FRP in JavaScript.

In this talk I’ll introduce the concepts of FRP and Bacon, and show how much nicer it is to work with than callbacks for realtime code. It will be a very visual talk using some visualisations of event streams that I am working on (http://latentflip.github.com/bac…) as well as some live code examples.