Yes, I know functional programming has been around since the 1950s. And, yes—Excel users are functional programmers. There’s nothing particularly new to see here.
Or is there?
There’s been sustained hype around functional languages for a few years now. Yet they have failed to break into the mainstream. Languages such as Haskell, Clojure and F# remaining frustratingly niche.
Except that they aren’t.
Functional programming is on the rise, but through approach, techniques and style—not language choice.
Functional programming languages have a lot going for them. They encourage (or enforce) functional design principles. And they often bring desirable features with them, such as powerful type inference. However, the real revolution in functional programming is happening through traditional enterprise languages—gradually introducing practising software developers to the ideas without forcing them into a "paradigm shift".
Why does functional programming matter?
Functional programming brings with it skills and concepts that are valuable when building modern applications.
One benefit for data scientists is that functions look like…well…functions. Mathematical functions to be more specific. The closer the code is to the equations you are using, it easier it is to make sure you have the correct implementation. There’s a reason that Excel and R draw heavily on functional ideas.
Today’s applications are increasingly asynchronous. Mobile…web…microservices…functions-as-a-service (FaaS). Asynchronous software is hard to write—and even harder to debug. Functional programming encourages practices such as immutability and isolation of side-effects that make it easier to reason about asynchronous code.
There’s a view, admittedly controversial, that the object-oriented programming (OOP) paradigm that’s dominated software development for over 30 years has retarded progress.
Alan Kay, who coined the term "object-oriented", has long criticised mainstream OOP.
I’m sorry that I long ago coined the term “objects” for this topic because it gets many people to focus on the lesser idea. The big idea is messaging.
He has also expressed his dissatisfaction with major OOP languages.
Java is the most distressing thing to hit computing since MS-DOS.
I invented the term "Object-Oriented" and I can tell you I did not have C++ in mind."
OOP’s singular focus on "nouns" has given us an industry of convoluted patterns in an attempt to impose some order–leading to
CommandExecutor classes with
As we build more complex, asynchronous systems, OOP is failing to scale effectively.
The tools used in functional programming—map, filter, reduce, copy-on-write, etc—are simpler and more generic than OOP patterns. And, as functional programming has a mathematical foundation (lambda calculus), it opens the door to more advanced tooling for automatically diagnosing problems in our code.
Unlike OOP, functional programming encourages us to separate our data from our calculations. This makes our code easier to test and aligns perfectly with today’s data-centric workflows. Data pipelines fit snugly into functional designs.
Can I use functional techniques without adopting a functional programming language?
Yes! That’s the point. Absolutely.
Functional programming is a set of concepts and techniques. It’s a way of thinking about and writing code. Sure, functional languages make it easier to apply those ideas, but you can apply them in any programming language.
And, as mentioned previously, modern languages are increasingly becoming hybrid languages—supporting the use of multiple paradigms.
Focusing on the concepts, rather than language features, will allow you to take your functional programming skills with you as you move from language to language during your career.
I’d argue that it’s worth learning at least one functional-first language as it helps consolidate your ideas, but it’s not essential.
Just start writing functional code. Today. Your customers will thank you for it.