Functional vs. Imperative Programming

Nov 2018


Babbage's Difference Engine alt-text Giles Moss

A powerful language must provide the following 3 mechanisms to allow the formulation of complex ideas from simpler ones:

  • - Primative Expressions
  • - Means of Combinations
  • - Means of Abstractions

Functional Programming

Functional programming is based on the following basic ideas:

  • - Evaluation of Expression.
  • - Binding Variables to Values.

The purpose of an Expression is to produce a Value, multiple related Expressions are grouped in a function. A Mathematical function is a process (or mapping) that associates elements of one set to another, such that each element in the domain is associated with exactly one element in the range.

The order of evaluations does not matter.

Imperative Programming

Imperative programming is based on the following ideas:

  • - Execution of Statements.
  • - Store of States

The purpose of a Statement is to alter the State of a variable in the Store of a program. A Statement may depends on the previous State of a Variable in order to alter it.

The order of execution does matter.