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!

Practical, actionable ways to improve each week.

Join 1430+ other devs and dev advocates on the Developer Microskills newsletter. Each week, I send out a practical, actionable way to grow in your career. No BS, no hand-waving, but with some fun thrown in for good measure. Sign up and I'll send you the Tiny Experiments framework and worksheet. It's a simple process to help you finish what you start.

Sam Julien © 2015 - Present