Down the Functional Rabbit Hole

First Published: January 21, 2016
Last Updated: May 22, 2017

One thing I'm discovering is that transforming data is easier to think about than maintaining state.

A few months back, in the wake of wrapping my head around observables and RxJS (still a work in progress), I spent a bunch of time digging through resources on functional programming. I left this compilation sitting in my drafts folder for a while, but then last night I stumbled upon this excellent article by Wayne Maurer on reactive data flow in Angular 2. Maurer expounds on André Staltz's concept of Model-View-Intent (MVI) in a reactive framework. It seems to me that one needs to grasp concepts of functional programming in order to fully understand reactive programming, so, to that end, here are some resources I've found helpful.

Functional Programming Basics and Overview

These videos and articles focus on broad FP concepts without delving too much into syntax or language-specific implementations.

Functional Languages: Haskell & Elm

Haskell has been around for a long time, but has been swinging back into popularity recently.

Elm is a newcomer to the FP scene and is a JavaScript adaptation based heavily on Haskell.

In the end, my takeaways can be summed up by a few notes I took during Neal Ford's talk. Functional programming stresses:

  1. Immutability over state transactions
  2. Results over steps
  3. Composition over structure
  4. Declarative over imperative

And, of course, composition over structure is all the rage these days in the JS world, and Angular 2 is no exception.

I'll leave you with this tweet from Michael Feathers:

OO makes code understandable by encapsulating moving parts. FP makes code understandable by minimizing moving parts.

Happy (side-effect-free) coding!

Come hang out by the digital campfire.

Grab a seat and let's chat about what's bringing us joy, what's working, and what's not as we walk the path of being better people and better developers.

Sam Julien © 2020