February 1, 2017
There’s a short comic floating around the Twitterverse that pokes fun at Functional Programming nerds. It’s often on my mind because I find it absolutely hilarious. It’s a subtle, subversive, and surreal kind of comedy. I can’t exactly explain why I find it so funny, but I do.
Like so much great comedy, it illuminates some aspect of our culture that needs to be addressed, or at least taken less seriously. Haskellers have a reputation for indulging in the use of esoteric language; monad, endofunctor, zygomorphism, etc.
Come with me on a journey.
Oh, it turns out all of Underscore.js’ function arguments are backwards, so using these functions the way they’re intended is now kind of awkward. I guess we can switch that out for Ramda.js or something.
Immutable data sounds far less complicated than keeping track of where state might change. Luckily, there’s a library for that too. Let’s just cross our fingers and hope that everyone on the team uses the immutable data structure library and not the programming language by itself.
I want to express what kind of data should be flowing in and out of all my little functions without having to write a million isolated tests. I guess I could use something like JSDoc and add a comment to the top of each function specifying the names and types of each parameter. I’ll have to trust myself to just be really careful that the documentation and the actual type signatures don’t go out of sync.
How about those pesky colleagues of mine though? Those kids are always meddling with my work; never bothering to update my precious documentation comments. What about some gradual type system like Facebook’s Flow? Ok, so it’s not totally reliable. And sure, it doesn’t enforce any kind of rigour — you can explicitly annotate any function to take anything as an argument, and return an anything.
Speaking of pesky colleagues: what about all those formatting errors that make it into code review? We’ll need to add linting to our build system. Wait…
We still haven’t gotten around to picking a DOM-diffing library or a Functional Reactive Programming state store, but there’s only so much that can be done in a day.
Are you still using MooTools? You are like a little baby. Watch this. Spread operator. Destructuring assignment.