jqcon-making-pigs-fly



jqcon-making-pigs-fly

1 4


jqcon-making-pigs-fly

Slides from my jQCon San Diego talk, "Making Pigs Fly: Functional Reactive Programming with jQuery, Flight and Bacon.js"

On Github lawnsea / jqcon-making-pigs-fly

Making Pigs Fly

Functional Reactive Programming with jQuery, Flight and Bacon.js

Lon Ingram

What is Functional Reactive Programming?

Oh jeez

If this description is gibberish to you, consult (a) Denotational design with type class morphisms, (b) Push-pull functional reactive programming (ignoring the implementation bits), and (c) the Denotational Semantics Haskell wikibooks page.

Wikipedia says

Functional reactive programming is "a programming paradigm for reactive programming using the building blocks of functional programming"

Functional Programming

That's like, monads and _.map right?

Wikipedia says

Functional programming "treats computation as the evaluation of mathematical functions and avoids state and mutable data"

Reactive Programming

Wikipedia says

Reactive programming is "a programming paradigm oriented around data flows and the propagation of change"

Spreadsheets are reactive

Circuits are reactive

Ok, so what is Functional Reactive Programming?

Twitter Flight

Flight is a "lightweight, component-based JavaScript framework that maps behavior to DOM nodes"

Bacon.js

Bacon.js is a "small functional reactive programming lib for JavaScript" that "turns your event spaghetti into clean and declarative feng shui bacon"

Observables

Reactive objects that can be subscribed to and transformed

Two types: EventStream and Property

EventStream

A stream of events that can be subscribed to and transformed functionally via map and reduce, e.g.

An EventStream represents one or more discrete values in time

Property

A reactive property that has a "current value" that can be sampled or subscribed to.

A Property represents a single continuous values in time

Show me the codes

https://github.com/lawnsea/jqcon-simon-says

npm install

grunt serve

Then load http://localhost:9099

Final Thoughts

Questions?