Bjarne Stroustrup made a comment in an interview about functional programming. He said advocates of functional programming have been in charge of computer science departments for 30 years now, and yet functional programming has hardly been used outside academia. Maybe it’s because it’s not practical, at least in its purest form.
I’ve heard other people say that functional programming is the way to go, but most programmers aren’t smart enough to work that way and its too hard for the ones who are smart enough to go against the herd. But there are too many brilliant maverick programmers out there to make such a condescending explanation plausible. Stroustrup’s explanation makes more sense.
Let me quickly address some objections.
- Yes, there have been very successful functional programming projects.
- Yes, procedural programming languages are adding support for functional programming.
- Yes, the rise of multi-core processors is driving the search for ways to make concurrent programming easier, and functional programming has a lot to offer.
I fully expect there will be more functional programming in the future, but it will be part of a multi-paradigm approach. On the continuum between pure imperative programming and pure functional programming, development will move toward the functional end, but not all the way. A multi-paradigm approach could be a jumbled mess, but it doesn’t have to be. One could clearly delineate which parts of a code base are purely functional (say, because they need to run concurrently) and which are not (say, for efficiency). The problem of how to mix functional and procedural programming styles well seems interesting and tractable.
[Stroustrup’s remark came from an OnSoftware podcast. I’ve listed to several of his podcasts with OnSoftware lately but I don’t remember which one contained his comment about functional programming.]
3 thoughts on “Why functional programming hasn’t taken off”
Functional programming has to be cool because John Backus invented it :-D Same goes for Fortran.
Seriously I’ve worked with what I understand are some of the functional programming features and they are cool and can make compilers more efficient. For example, working at the whole array level in SPlus and promising the compiler that a routine has no side effects. It is a whole other way of thinking though.
Functional programming is imperative programming taken to an extreme – abolishing state and side effects instead of minimizing them. OO is modularization taken to an extreme.
How about Clojure’s approach – using the JVM as a platform and allowing full integration with Java – which means that a software project can have components written in Clojure (for the heavy lifting stuff) and Java for the rest.