April 17, 2019

FP for OO

Jargon free FP


Richard Feynman famously said "Names don't constitute knowledge". Coming from the OO world, the names of concepts and the jargon of Functional Programming is opaque. Its an impediment to learning the underlying concepts and why they are useful.

For example:

All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.

Saunders Mac Lane

You could memorize this definition and still know absolutely nothing about this thing named 'monad'.

The goal of the next few posts to get at some underlying FP concepts, and to share some intuition of when and why to use them.

I'll avoid as much FP jargon as possible. However I will introduce FP specific terms when its necessary, highlighting when I do so with jargon styling

This series is for people who want to learn Typed Pure Functional Programming in Scala. It is aimed predominantly at OO devs, especially from curly brace languages. Familiarity with concepts like Java 8 streams and C# Linq & JavaScript functional syntax will be useful. Devs from other OO and imperative backgrounds may find it usefull too.

Topics like basic Scala syntax, recursion, folding, reducing and general functional problem solving won't be covered here. A quick and dirty Scala syntax tutorial can be found here: https://learnxinyminutes.com/docs/scala/

I'll probably use concepts that may not be perfectly accurate. These are just metaphors and intuition pumps.

Many of these concepts are part of my mental model of FP, however they may not be technically correct & I occasionally see them poo poo'd within FP community.

But the goal here isn't to learn category theory. It is to try and see why FP is so useful. Once you have the intuitions, maybe you can forget the metaphors.

Anyone who understands, eventually recognizes (these concenpts) as nonsensical, when he has used them — as steps — to climb beyond them. He must, so to speak, throw away the ladder after he has climbed up it.

He must transcend these propositions, and then he will see the world aright.

Next Up: What is FP - https://blog.marktranter.com/what-is-functional-programming


Intro - https://blog.marktranter.com/fp-introduction/
What is FP - https://blog.marktranter.com/what-is-functional-programming/
The M Word - https://blog.marktranter.com/fp-in-oo/