Does Functional Programming Matter?

A number of years ago, I gave a talk at a tech conference, and in the feedback, I received a ‘complaint’ that I didn’t really explain how I was writing the code that I was publishing as part of PowerTools for Open XML – code such as RevisionAccepter, ListItemRetriever, and HtmlConverter. Developers sometimes look at the code in those modules, and their reaction is “Huh????” The main problem with presenting those coding techniques was that I had one hour at that conference, and to explain the techniques I was using, it requires something more like five hours.

Flash-forward four years – those techniques have held up well over time. I still regularly use the approach. I can write robust code that performs well. For example, after publishing RevisionAccepter, I have not needed to touch the code even once. I have translated large chunks of that code to JavaScript and the approach works equally as well there. (I’ll publish that JavaScript code, all in good time.)

Why does Functional Programming work for me?

It lets me work in my domain. My domain is document formats, and more specifically, Open XML. When writing transformation code, I want to be thinking about the various Open XML elements and attributes, and their semantics, and contemplating on what I want to do to them. I don’t want to be writing large chunks of procedural code that doesn’t have a close correlation to the algorithm I am implementing.

While you must learn new patterns and idioms, after you master them you can write code that directly reflects your intent. Further, you can come back to code that you’ve written years previously, and read, understand, and modify it. But you must learn the patterns and idioms.

I have recorded a screen-cast series on writing Recursive Pure Functional Transforms. A single weekend invested now will yield dividends over your entire career. And further, functional programming is fun. It is an enjoyable way to write resilient, non-brittle code. It lets me leverage my time and write more code that does what I want it to. The economic benefit is clear.

So yes, functional programming matters very much.

Cheers,
Eric White