May 15, 2015

Functional Programming from the Fire Hose

Earlier this year I gave a presentation at work entitled "Functional Programming (FP) from the Fire Hose." My goal was to present, to a mostly OOP audience, some of the basics of FP while also providing examples that show that FP isn't just academic. You can't sell people on FP with concepts alone. People's eyes just glaze over and roll back into their heads when you start talking functional concepts like first class and higher order functions, immutability, statelessness, referential transparency, homoiconicity, and the like (I won't even say the M-word). With that in mind, I tried to go fast on FP and show several clear examples that demonstrate FP in action, even at a very small scale.

In my presentation, I do (or attempt to do) the following:

  1. Explain FP in 5 minutes to an OOP audience
  2. Explain why functions are important using collections as the context.
  3. Explain that first class functions are a necessary but not sufficient condition for FP. You also must have immutability.
  4. Solve a small problem in both FP and OOP style. The examples, written in Clojure and Java, respectively, show the simplicity and power of FP vs. traditional OOP.
  5. Demonstrate how you can write functional code in a stateful application using Clojure concurrency primitives.

Here's the video and links to additional resources. I hope you enjoy.

The slides are here, and the accompanying repo and demo are here.

If you liked this page or learned anything from it, please tweet the link,follow me on Twitter, and/or follow this blog. Your support and interest is the fuel that drives the effort.

Tags: scala clojure java functional programming clojurescript