A Map to Success

Functional Programming for Database Developers

Kevin Feasel (@feaselkl)

Who Am I? What Am I Doing Here?


  1. What is Functional Programming?
  2. Why Go Functional?
  3. Demos Galore

What is Functional Programming?

  1. Functions and Data, Data and Functions
  2. Immutability
  3. Expressions
  4. Functions are higher-order

Functions and Data

Functional programming is all about data and the functions we use to transform that data.

Data retains the shape of data rather than objects (data + accessors + mutators) and functions remain separate from data.


Never change the data itself. Create a new structure with new data.


  1. Concurrency -- critical for Big Data solutions
  2. Separates data and functionality
  3. Idempotence makes reasoning and testing easier


Functions take inputs, return outputs, and ideally do nothing else (that is, have no side effects).

This makes reading code much easier: you can abstract away functional complexity and think at the grain of the problem.

The opposite: an accessor ("get" property) which modifies data, or a Get procedure which updates tables.

Functions are Higher-Order

Functions are values like integers or strings. You can take a function as an input to a function and a function can return a function as an output.

Functions are an abstraction for performing operations on data. This approach leads to composition: layering functions together rather than implementing parent and child objects through inheritance.

An Analog: the APPLY Operator

An Analog: the APPLY Operator

A Quick Example

Relevant functional programming concepts:


  1. What is Functional Programming?
  2. Why Go Functional?
  3. Demos Galore

Why Go Functional?

Reasons to learn about functional programming include:

  1. Key data science and Big Data languages are functional.
  2. Functional programming can earn you more money.
  3. Database developers will have an easier time learning it than OO languages.

Data Science and Big Data Languages

Reasons to learn about functional programming include:

Data science:

  • R
  • Julia (sort of)

Big Data:

  • Scala

Key concepts:

  • MapReduce


The Functional Mindset

Database developers have a leg up on thinking functionally:

  1. We think in terms of sets and set operations.
  2. We think in terms of data and operations on data.
  3. We think in terms of declarative operations instead of imperative step-by-step operations.
  4. Functional programming makes it easier to avoid the object-relational impedence mismatch problem.

What if I'm a C# / Java Dev?

Functional programming still helps people who work in C# and Java all day.

We have seen more and more functional programming concepts make their way into these languages, especially C#. LINQ, lambda expressions, async and Task<>, Func<>, non-nullable object types, record types, and more have made their way into C# (at least as of C# 8).


  1. What is Functional Programming?
  2. Why Go Functional?
  3. Demos Galore

Demos Galore

We will now look at an F# console application filled with basic examples of what you can do with the language.

This isn't always the best code and it's not a perfect guide for learning the language, but it gives you a feel for behavior and a few of the language benefits.

Wrapping Up

Functional programming has its own mindset which can take time getting used to, especially if your background is as an object-oriented developer. There are significant benefits to building up your FP skills, especially if you are interested in the Data Engineering space, where languages like Scala dominate.

Wrapping Up

To learn more, go here:

And for help, contact me:
feasel@catallaxyservices.com | @feaselkl

Catallaxy Services consulting: