Functional Programming for the Rest of Us
Programmers are procrastinators. Get in, get some coffee, check the mailbox, read the RSS feeds, read the news, check out latest articles on techie websites, browse through political discussions on the designated sections of the programming forums. Rinse and repeat to make sure nothing is missed. Go to lunch. Come back, stare at the IDE for a few minutes. Check the mailbox. Get some coffee. Before you know it, the day is over.
The only thing, every once in a while challenging articles actually do pop up. If you’re looking at the right places you’ll find at least one of these every couple of days. These articles are hard to get through and take some time, so they start piling up. Before you know it, you have a list of links and a folder full of PDF files and you wish you had a year in a small hut in the middle of the forest with nobody around for miles so you could catch up. Would be nice if someone came in every morning while you’re taking a walk down the river to bring some food and take out the garbage.
I don’t know about your list, but a large chunk of the articles in mine are about functional programming. These generally are the hardest to get through. Written in a dry academic language, even the “ten year Wall Street industry veterans” don’t understand what functional programming (also referred to as FP) articles are all about. If you ask a project manager in Citi Group or in Deutsche Bank1 why they chose to use JMS instead of Erlang they’ll say they can’t use academic languages for industrial strength applications. The problem is, some of the most complex systems with the most rigid requirements are written using functional programming elements. Something doesn’t add up.
It’s true that FP articles and papers are hard to understand, but they don’t have to be. The reasons for the knowledge gap are purely historical. There is nothing inherently hard about FP concepts. Consider this article “an accessible guide to FP”, a bridge from our imperative minds into the world of FP. Grab a coffee and keep on reading. With any luck your coworkers will start making fun of you for your FP comments in no time.
So what is FP? How did it come about? Is it edible? If it’s as useful as its advocates claim, why isn’t it being used more often in the industry? Why is it that only people with PhDs tend to use it? Most importantly, why is it so damn hard to learn? What is all this closure, continuation, currying, lazy evaluation and no side effects business? How can it be used in projects that don’t involve a university? Why does it seem to be so different from everything good, and holy, and dear to our imperative hearts? We’ll clear this up very soon. Let’s start with explaining the reasons for the huge gap between the real world and academic articles. The answer is as easy as taking a walk in the park.