Functional Reactive Programming

Functional Reactive Programming

Slides for a talk by Wilkes Joiner at Nashville Code Co-op Talk Day.

8341c5bff3dcbd8ed34d9d68bd4169f2?s=128

Jason Orendorff

March 30, 2013
Tweet

Transcript

  1. 6.

    Streams of Events • Fire and forget events are relatively

    easy to create. • UIs • Ajax posts
  2. 7.

    Streams of Events • Fire and forget events are relatively

    easy to create. • UIs • Ajax posts • Messaging queues
  3. 12.
  4. 14.

    FRP • A model for values that vary over time

    • Originates from Haskell Community • Several different implementation styles • We are focusing on Microsoft’s ReactiveExtenions style
  5. 17.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take
  6. 18.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext
  7. 19.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling
  8. 20.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay
  9. 21.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay • Buffering - Last N events
  10. 22.

    Observable • A marriage of Iterables and the Observer Pattern

    • Typical Sequence functions - Map, Filter, Reduce, Take • Subscribe/OnNext • Error Handling • Timing function - Delay • Buffering - Last N events • Composable - SelectMany/FlatMap
  11. 39.

    Autocomplete • On Keyup • Get the value of the

    field • Only values of length 3 or more • Make remote call • Filter out bad response • Display results
  12. 40.

    Autocomplete in reality • On Keyup • Get the value

    of the field • Throttle to 500ms • Only values of length 3 or more • Skip duplicates • Make remote call • Filter out bad response • Display results