In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state. -Wikipedia
I’ve been a programmer for 25+ years and back in the earliest days a lot of PC-based code was implemented in x86 assembler. Later on ‘C’ became the de facto standard yet we still counted CPU instructions and IO operations.
As the web evolved and programming languages have come and gone many of the oldies are still in play. In fact many of the benefits of functional programming languages are limited or obscured by the non-functional OS and systems they rely on. Both scala and clojure rely on Java’s JVM and they also depend extensively on standard old java libs, which are not functional, instead of replacing everything with native versions as one would expect.
Haskell and Erlang, on the other hand, while they are basically clean room implementations with few dependencies other than GCC and many of those libs; at some point in the stack they touch the libs for the OS. Erlang has the benefit that the libs and overall packaging seems contained and professional where Haskell seems more chaotic and scientific. Not that one is actually better than the other… Haskell’s Snap seems to be a better platform than Erlang’s yaws, webmachine or nitrogen.
Recently there was a post on slashdot in which an anonymous coward indirectly suggested the smartest programmers don’t work for Google. I’m sure there is truth to the statement but the description that this person gives of his day to day activities are no different than I have experienced depending on the circumstances. In fact it takes more balls and bravado than high IQ to hack trading systems in the way he described. In fact I dare say that the SEC might consider an investigation into this individual; while he might be smart, some day he’s going to write a patch that his bank cannot cash.
What initially attracted me to Erlang was it’s sigma references. It seemed to me that if a phone switch was to operate at 9-sigma then my bank software should too. Now that years and several applications have passed, all written in Erlang, I have come to the conclusion that sigma is not a good enough justification for a business application. And that it should be a business decision as to which language one implements the business in.
I think there are two main reasons why functional programming is popular: 1) because it is different. 2) because the smart guys are making a lot of money with it.
Just because you say you are “different” does not make you different wen you are standing in a crowd of people who are all different too.
In response to being “different”. There is no real justification here other than curiosity. There was a time when C and Pascal, forth competed for mindshare. In fact P-Code almost became the foundation for an operating system/platform but it never had the performance or mindshare. Once serious development began on *nix ‘C’ took hold although MS-DOS was still written in x86 assembler. And so were a number of desktop environments like TopView, DesqView and many others. C was low enough to let the programmers tinker and high enough to be useful for cross platform development. And easier to debug than assembler.
And as far as what the smart guys are doing… it also reminds me of a time when I almost went into smalltalk development. At the time consultants were making 100 – 150% more than the average programmer at the time. And while a lot of good work had been accomplished at the time. Where are these guys now? Where are their applications? Who is maintaining them?
As a side note; part of the reason why Microsoft invested in .NET was partly because they wanted to give their platform a name. Some way they could bolster OS, it’s development platform and the collective ego of the .NET certified programmer. Microsoft’s choice to alter java with J++ and moving everything to their CLR was all about mindshare.
I recall interviewing for a company that did datamining of personal information. I liked the idea and complexity of the problem, however, after making it through the interview process I was told that the position required that the programmer use their internal programming language. It was internal and proprietary. Needless to say I never accepted the position.
Yahoo is primarily a PHP shop. a) to be different from the other web properties. b) to keep their employees from jumping ship.
Google is primarily a python shop. a) to be different from the other web properties. b) to keep their employees from jumping ship.
These companies have functional applications too. But why? Is it really worth the effort? Should we really re-tool for functional programming? Consider the amount of Java code that is out there. Why would anyone rewrite it in the functional fashion? Consider all of the non-functional code that we have come to rely on. Should we really rewrite it all in a functional environment (this is the only reason I like scala and clojure)
This topic makes my head ache. There is no rational justification for the attention to functional programming. It’s just a game.