Social Media

Explaining Functional Programming

It occured to me that while I know what Functional Programming is, I would struggle to explain it. My description would be something like –

Mmmmnnnn…. not good.

This post is my attempt to provide a better description of functional programming, and let me know any feedback or mistakes

What is Functional Programming?

Functional Programming uses mathematical functions to solve problems. Functions take an input and give an output, without changing the input –

Common Features

  • Functions are first class entities – can be assigned to variables, passed as arguments, or returned from other functions
  • No state
  • No side effects – Anything the code does except produce an output from given inputs

Consider the example below the where setting I changes the changeState field, and also log. The are side effects as they go beyond returning an output from an input.

  • Lazy evaluation – Compiler can decided when best to run a function

The degree to which the above features are enforced depends on the language

Advantages of Functional Programming?

Functional Programming means that a function will give the same output for a given input, and doesnt alter state. This makes it well suited for problems involving –

  • concurrency
  • multi-threading
  • multi-processors


About the Author Martin Farrell

My name is Martin Farrell. I have almost 20 years Java experience. I specialize inthe Spring Framework and JEE. I’ve consulted to a range of businesses, and have provide Java and Spring mentoring and training. You can learn more at About or on my consultancy website Glendevon Software

follow me on:

Leave a Comment: