Its been a while that we are seeing growing in the use of functional programming languages. We see names like Haskell, Python, Erlang, Elixir, Clojure, and F# growing in question tags at Stack Overflow. Also, altough subtly, we have more job offers requiring experience in those languages aswell.

Functional programming

But what exactly causes this rise in popularity?

To begin an answer, I would like to say that functional programming is not so unpopular as many of us could think. It's been studied, promoted and written since '60s, and it is still being in this decade. In the late 1980s, it appeared as if it was poised for mainstream impact. Many mature tools, techniques well studied and good books and courses all around: it was a particulary active area in the UK at that time.

John Backus, the inventor of Fortran, gave a famous Turing Award lecture in 1978 showing, with details, the pitfalls of being locked into imperative thinking. The lecture can be found in the network, and begins with a curious title: "Can Programming Be Liberated from the von Neumann Style?".

Backus called the style of programming that was popular in that time "von Neumann Style" for a reason: it does mimic the structure and processes of the von Neumann computer, in wich we have three principal parts: a central processing unit, a store and a connecting tube for transmssion of a single word between the CPU and the store. In this model, the task of a program consists basically in changing the contents of the store in some way. According to him, this model should not have been mimicked by programming languages:

Conventional programming languages are growing ever more enormous, but not stronger. Inherent defects at the most basic level cause them to be both fat and weak: their primitive word-at-a-time style of programming inherited from their common ancestor - the von Neumann computer, their close coupling of semantics to state transitions, their division of programming into a world of expressions and a world of statements, their inability to effectively use powerful combining forms for building new programs from existing ones, and their lack of useful mathematical properties for reasoning about programs.

He continues his reasoning by saying that programming languages appear to be "in trouble", and ends up with a detailed comparison of the actual famous style versus a new form of programming being studied and used at that time.

Despite those studies, uses and warnings from people like Backus, popularity crowded out functional programming good ideas for much time. Some of us could say that because alternative ideas have no standing in popular mind, programming became modelled by the von Neumman machine, wich started basically by Fortran and C. And it continued on, despite years of principled opposition against ideas like null pointers , mutability, reflection and dynamic typing spread.

What may be the cause of this change was business and principally, the web. The ever fast growing of the paralell computing, fault tolerance, more and more complex business problems are beginning to sound like "we need a new way of doing this thing". Both business and the web may need functional programming more than ever. Criticize the actual programming style in that way may sound harsh, but the truth is that every functional programming evangelist defends that it should be better than it.

So, there is nothing new in this resurgence. It is just a rediscovery of something that has been known and promoted in vigorous and long career by many functional programming researchers. Its the same thinking about what people call "innovation" today: they think that most of them are based on new and disruptive ideas that were crafted out of nowhere, but in fact, they were placed in a shelf made by universities: studies that have been done and made available to the community. All we need to do is take them, and use them.