I don’t often dedicate a blog entry to just a link, but this one is important. Important, that is, if you’re a computer programmer; in particular a programmer who needs to make code run faster on existing real-world hardware. Which is a minority of a minority, since it excludes most Webfolk whose servers are fast enough and clients are running 90% idle time. But that minority really needs to be thinking about Functional Programming, and if you’re not 100% sure you know what that means, you should drop everything and go read “Uncle Bob” Martin’s Functional Programming Basics.
It’s the best short explanation of what FP is about, and why it’s important, that I’ve ever read anywhere. So even if you do grok FP, you should probably go read it anyhow, because it may equip you a little better for the tricky task of explaining the goodness.
I dedicated a couple of years of my life to this stuff when I was at Sun; scan the Concurrency tag here for the findings.
I’ve got little two gripes with Uncle Bob’s presentation here, which don’t detract in the slightest from its fundamental importance:
His use of the nifty Clojure
I think that when you’re
introducing new material to illustrate something particularly wonderful, in
this case the no-assignments magic of FP, it’s best to avoid clouding the
picture with other flavors of magic, in this case an object that cleverly
pretends to be infinite in size but is perfectly useful in finite-world
practice. For example, Ruby’s
way less spooky.
It’s in LISP. Which has had fifty-five freaking years to catch on and become mainstream, and if it were going to, it would have. Yes, illustrating FP with somewhat-more-mainstream technology is more work, but the work is probably worthwhile.
The “Java Moment” · My work at Sun was based on the premise that FP in the 21st century is like Object-Orientation in the eighties: Potentially hugely useful, but not really accessible to mainstream app builders. Java came along and made O-O mainstream, with a clever combination of familiar idioms and decent libraries.
I believed (and believe) that the conditions are right for something else to come along and do for FP what Java did for O-O. Both Clojure and Scala are consciously trying to do this, and not coincidentally, on the Java platform. But I don’t think either quite hits the mark; there’s still a big place in the ecosystem waiting to be occupied.