Functional Programming

Composition

Composition in the essence of functional programming. What exactly does composition mean though? Composition means creating a composite of two or more operations. Passing the output from one operation to the input of another operation.

Composition is:

Pure functions

If you call a function and don’t use its return type you are probably using an impure function.

A function is pure if you can replace the entire function with the

Imperative vs Functional

Imperative programming works with statements

Functional programming works with expressions

The value that an expression evaluates to can be given a name.

[1, 2, 3] is an expression and the “result” of this expression can be assigned to a variable.

const x = [1, 2, 3]

mutating an existing object is a bug

All software is automation. Given enough time, anything you do on a computer, you could do with paper, ink, and carrier pigeons. Software just takes care of all the little details that would be too time consuming to do manually.

Learn to recognize characteristics of good abstractions: