Functional Friday 1: Background

Excited

It's...Functional Friday!

Being the first one, I think some background for Functional Programming (FP) makes sense. So a bit on programming paradigms...

First, it is interesting to note that the very first Turing-complete languages were of the functional paradigm. Turing complete, remember, means that the language can express any computation. That is, anything you can do with C#, you can do with a functional language. Anything. Because they're both Turing-complete.

Lambda calculus, developed in the 1930s, is considered the first of these, although it was not a computer programming language per se, but can express the same computations, mathematically. (I have no interest in expressing any of my projects in lambda calculus btw.)

The first high-level programming languages like FORTRAN though were imperative: sequences of instructions change a program's state. Why? Quite naturally because this is how the CPU/RAM architectures worked, and still work. But is imperative programming the most natural and efficient way for humans to think of their programs?

Of course then came object-oriented programming, which helped organize all of these memory-manipulating instructions into objects, and when well-named, it can be a very natural way in which to think of a program, as it in a sense simulates our real world: multiple objects that have state and that interact (method calls). (See? I'm not an FP fanatic that has nothing good to say about OO.) Oh and guess what, the very first OO languages like SIMULA were for simulating the real world.

Now, fast-forwarding into modern day OO programming: have you heard the advice to prefer immutable objects? (If not: prefer immutable objects!) Also, remember when lambdas were introduced to C#? (They were later introduced to Java as well, and C++). LINQ? All of these are taken from the FP paradigm. Think how do each of those features help your code better.

My interpretation? We are gradually returning to our functional roots. But not because we love lambda calculus. Because we love working code, and we're learning more about what makes that happen.