Glossary · Programming

Functional Programming

Functional programming is a style that builds programs from pure functions and immutable data, avoiding shared state and side effects.

Updated October 6, 2026

Functional programming is a paradigm that treats computation as the evaluation of functions. It favors pure functions, which always return the same output for the same input and change nothing outside themselves, and immutable data that is copied rather than modified.

Why it matters

Pure functions are easy to test and reason about because they do not depend on hidden state, and they are safer to run in parallel. Languages such as Haskell are built around the idea, and JavaScript, Python and Java support much of it through features like map, filter and lambdas.

Example

const prices = [100, 250, 40];
const withTax = prices.map(p => p * 1.18);
const big = withTax.filter(p => p > 100);
const total = big.reduce((sum, p) => sum + p, 0);

Each step returns a new array and leaves prices untouched. Nothing outside the expressions is modified.

Common mistakes

  • Calling a function pure when it quietly reads the clock, a global or a database.
  • Copying very large data on every change without considering performance.
  • Treating it as all-or-nothing; many teams mix it with object-oriented code.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.