Warm Blooded Languages

There are many programming languages, but just two main families.

Dinosaurs died out during a mass extinction event, similarily today's largest programming family are cold blooded; not very smart; and about to give way to a smaller furrier type of language.

Primordial Goo

In the '50s computers were large and slow. Computer scientists spoonfed computers in digestable ones and zeros.

Not much later, computers became faster and programmer effectiveness more important. Programming languages abstracted away from the machine's native tongue.

Instead of communicating directly with the computer, people write in intermediate human readable languages which the computer interpets back into its own binary language.

They are called imperative languages. In essence, the computer is instructed how to change its internal hardware with high level commands.

No more ones and zeros. More can be coded in less time.

This process has continued until today. The more we abstract away the easier it is to program.

Nevertheless each imperative language still has the machine at its heart.

A Rodent By Any Other Name

The first functional language was called Lisp. An ancient rodent, whose ancestors are still around today.

Functional languages don't have a bionic heart. Instead they are mathematical.

Maths is the language of choice to communicate logical arguments.

Why worry about RAM, hard disks and CPUs when you can focus on ideas?

This makes for succinct code.

A Picture's Worth More...

However it also makes them slower. Computers find it harder to understand functional language. In fact they have only become fast enough to interpret them in the last decade.

No need to tell the computer what to do any more. We describe mathematical ideas, which the computer has to spend energy re-interpreting. It has to step out of its comfort zone.

Taken to its logical conclusion, functional programming is declaritive.

A common example is describing the rules of Sudoko, and letting the machine figure out how to solve a puzzle.

Another would be to describe prime numbers; then ask a question. E.g. what are the first 100 prime numbers?

No need to worry about variables stored in memory; looping while some condition is true; or other common minutiae.

Just, describe the problem and leave the computer do the rest.

Black Box

Lisp is a functional language, but it never reached the logical declarative conclusion.

It turns out that the functional dream is not very practical.

A computer does many things at one time. A function in an imperative language (and Lisp) has inputs and outputs but often needs to change something on screen while number crunching.

A mathematical function, on the other hand, ensures outputs will remain the same when the inputs are unchanged. Something you cannot ensure when a function depends on or modifies shared resources.

Without the ability to manipulate a shared resource, our 'purely' functional program becomes a black box.

Academic researchers, never let an opaque box worry them, happily fiddling with purely functional languages without 'side effects' for decades before finding a way to do practical work in the 90s.

That is, until monads were discovered. A mathematical trick which enables practical useage.

I.e. purely functional languages can now write to screen AND take input AND calculate a solution all at the same time.

Well, what else would we expect from a program?

The Mouse That Roared

Every programmer aspires to elegance, but imperative languages won't die due to the aspiring poet within.

The end of Moore's law will finish them off sooner rather than later.

CPUs are not growing faster. They are reaching physical speed limits. For years, more cores with the same speeds are being sold in every CPU.

Remember, the imperative model is an abstraction from machines with one CPU heart, not many.

Shared resources are either ignored by imperative programming (don't remember the last time your new laptop felt really fast?) or the multiple CPUs clumsily step on each others toes, easily causing crashes.

Luckily functional languages fit modern computers like a comfortable shoe. They ensure CPUs work well together.

Our furry rodents are set to thrive, naturally growing more capable as more CPUs become available in every computer.