Some people love it and claim it’s the only way to write software. Others see it as a fad and roll their eyes.
Let’s come away from those extremes. Functional Programming is based on a foundational computational model called Lambda Calculus, which all programming languages (OO or FP) are based on . It’s not magical, nor is it something you should ignore because you’re amazing. It is simply something you need to understand.

Like most things in Computer Science, functional programming is full of jargon, idioms and practices that, at first, might be a bit opaque. If you take the time, however, to let it soak in... functional programming can change the way you write software if you come from an object-oriented background.

Opening Our Minds

I learned a functional language two years ago; one that I love using: Elixir. It has changed the way I think about programming. It’s the only functional language I know, so I’ll be using it to do some of the demos you’re about to see.

For others, I’ll be using JavaScript/ES6. I chose this language because 1) most programmers know it at least a little and 2) it has some functional characteristics - at least to the level where you can get your point across.

We’ll cover four main topics in this section:

  • Immutability (things that can’t/don’t change)
  • Purity (functions rely only on what they’re given)
  • Side Effects (functions only operate on data they’re given)
  • Currying (breaking big functions down to little ones)

I also added a bit on Functors and Monads which, if I'm honest, could be a fool's errand as you'll see. As the old line from Douglas Crockford goes:

In addition to it being useful, it is also cursed and the curse of the monad is that once you get the epiphany, once you understand - “oh that’s what it is” - you lose the ability to explain it to anybody.

Let's see if that holds true.

You must be logged in to leave a comment