In his presentation Why Pure Functional Programming Matters, Christoffer Ekeroth focuses on a very down-to-earth problem: it’s not writing new code that slows teams down, it’s understanding the old code. As codebases grow, mutation, hidden side effects, and null make even simple-looking expressions hard to trust. That’s why so many developers are afraid to change code — they’re not sure what they might accidentally break.
Why Pure Functional Programming Matters: A comprehensive overview
Christoffer Ekeroth delivered a clear and entertaining explanation of a question many developers have asked – and many more have struggled to answer in front of their managers: Why does pure functional programming actually matter?
His goal was simple: show, in concrete and relatable terms, how purity, immutability, and explicit effects make software easier to understand, cheaper to maintain, and safer to change.
The core problem: Understanding code is the bottleneck
Modern software development isn’t constrained by how fast we type new features.
It’s constrained by how fast we can understand the code that already exists.
Christoffer highlights a sobering statistic: in a 2020 Sourcegraph survey, 75% of developers said they are afraid to change code for fear of breaking something. This isn’t irrational — mutation and hidden side effects make even simple-looking code deceptively unpredictable.
He demonstrates this with humorous examples, starting with the classic JavaScript “type coercion surprise”, then gradually escalating to more realistic — and problematic — cases in C, Java, Scala, and F#.
Mutability: The silent complexity multiplier
In imperative languages, a simple expression like 1 + a > a should obviously be true.
But with mutable data and operator overloading, it’s possible for such a trivial expression to behave unpredictably.
The key insight:
When any function you call might mutate something you passed in, you can’t “sight-read” code anymore. You must understand everything it touches.
This creates a worst-case cost of change proportional to the size of the entire codebase — and that cost compounds as a project grows.
Side effects: The hidden traps
Even if you avoid mutation, side effects — exceptions, I/O, network calls, logging, DNS lookups(!) — can lurk anywhere.
Christoffer’s shocking example: in Java, simply comparing two URL objects can trigger a DNS lookup under the hood. A pure-looking expression suddenly becomes a fallible, slow, network-dependent operation.
This is how code that “should be fine” ends up:
- crashing unexpectedly
- causing performance degradation
- becoming impossible to confidently refactor
Null: The billion-dollar mistake
Christoffer reiterates Tony Hoare’s famous regret: null is an anti-feature.
It introduces hidden failure paths and breaks equational reasoning.
Modern languages have Option, Maybe, or union types — use them.
And when you can’t avoid nulls (e.g., external APIs), sanitize them at the boundaries.
The real-world example: A “Pure” function that isn’t
Christoffer shows a realistic F# example: a function named validateEmail.
You expect it to:
- take a string
- validate format
- return Result<Email, Error>
But it might actually:
- perform a database lookup
- or call a microservice
- or do multiple slow operations you’d never suspect
This is the heart of the problem. Without discipline, side effects leak into business logic, turning pure functions into landmines.
How pure Functional Programming fixes this
Christoffer emphasizes that functional programming isn’t magic — it’s discipline supported by language features.
1. Separate Pure and Impure Code
A proven strategy is the “functional core, imperative shell” model:
- At the edges: do I/O, database calls, HTTP, filesystem work
- At the core: pure functions that operate on data
Pure functions become easy to test, reason about, and refactor.
2. Make Effects Explicit
This can be done via:
- Dependency injection (pass side-effectful components into functions)
- Effect systems (return values that represent effects, resolved later)
- The IO Monad (as in Haskell)
- FRP/event-based architectures (React, Elm, Redux)
The key is this:
If a function performs side effects, it must be visible from its signature.
This restores trust and predictability.
Equational reasoning: The real payoff
All of these practices enable equational reasoning — treating programs like mathematics:
- If a function is pure, you can replace it with its output.
- You can reason locally without scanning the whole codebase.
- f(x) always means the same thing everywhere.
This is the superpower that keeps long-lived FP codebases maintainable.
Christoffer argues that when you achieve this:
- The cost of change does not rise dramatically over time
- Large codebases remain approachable
- Developers work with confidence instead of fear
Even AI coding tools (like copilots/agents) benefit from smaller context windows
But what about reality?
Christoffer acknowledges that real systems need side effects — API calls, complex flows, conditional logic, iterative I/O.
His advice:
- FP isn’t about eliminating effects, but containing them
- Use pragmatic tools: DI, effect libraries, good architecture
- Don’t rewrite everything at once—modernize gradually
- Solve actual problems, not hypothetical ones
- Don’t introduce FP patterns in isolation—use tests, adopt incrementally
And importantly:
FP works best in FP languages, but its principles can improve any language — from TypeScript to C#.
Final thoughts
Christoffer’s central message isn’t dogmatic.
He’s not arguing FP is superior because of elegance or academic purity.
He’s arguing it’s superior because:
- it makes code easier to understand
- it reduces fear and cognitive load
- it keeps systems from grinding to a halt as they age
- it empowers both humans and future AI agents to work more safely
- it protects developers from subtle, disastrous bugs
And perhaps most importantly:
it lets developers relax and think less about accidental complexity.
That’s something every team — and every boss — can appreciate.
Additional resources
- Christoffer Ekeroth: LinkedIn
- Functional Programming ROI
- Seamless banking experience with F#
- The FP pitch