Functional programming's high efficiency comes at a cost

Though tough to define, functional programming can bring real productivity boosts if you can navigate the learning curve

Functional programming can offer a more productive style of software development, but it takes some getting used to.

With the functional paradigm, which is enabled in languages like Haskell, Scala, and Clojure, computation is treated like mathematical functions, avoiding changing state and mutable data. During a panel session at the QCon conference in San Francisco this week, developers said functional programming enables more work to get done with fewer developers. Their caveat: It requires buy-in from developers and maybe management, too.

Twitter, for example, has a training program to get developers up to speed on Scala in a very short period of time. "I got into functional programming because it solves problems," noted Marius Eriksen, an infrastructure engineer with the company.

Developers, meanwhile, need the freedom from management to try new things, Verizon's Stew O'Connor, software architect, said. "Developers have to be allowed to experiment and have to be allowed to fail."

"Really, the goal of functional programming is that you have to hire less people," and developers can be more productive, said Logan Linn, software engineer at Prismatic. And functional programming extends to different sizes of systems, O'Connor stressed. "One of the beauties of functional programming is that when you're doing it right, the way you build small systems and the way you build large systems should be roughly the same."

Panelists, though, recognized it can be tough to define what, exactly, constitutes functional programming. The degree to which a language qualifies as "functional" also is in question.

"I'm not sure anybody here uses a strictly functional language," said Jafar Husain, cross-team technical lead for UIs at Netflix and a member of ECMAScript standards committee. "One of those interesting things to talk about is exactly what constitutes a functional language." Husain said he would settle on the definition as having the ability to pass functions as values. Java, with the recent release of version 8 and use of closures, now would now qualify to be as functional as Scala, and even the Excel spreadsheet and C# could be considered functional programming, he said.

Copyright © 2014 IDG Communications, Inc.