What’s Ahead for Functional Languages?

Languages that support functional programming are moving out of the fringe, now being put to use in mobile app development, cloud computing and multicore platforms.

Functional programming, which has its origins in the field of mathematical logic, has been something of an academic exercise over the years. But some languages are getting a bit more visibility. Those include F# and Scala, which incorporate features of both functional and object-oriented languages, and Clojure, a Lisp derivative described as predominantly being a functional programming language.

Going Mobile
Active areas for functional programming include Android app development, where Scala is cultivating a niche. Developer productivity is the main consideration behind the use of Scala in this setting, according to Donald Fisher, chief executive officer of Typesafe, and Phil Bagwell, the company’s marketing manager. Typesafe was launched earlier this year and provides a packaging of Scala, Akka middleware and developer tools on an open-source basis.

Since Scala is a succinct language that supports the functional programming style, developers typically can get more done with fewer lines of code, say the executives, who participated in an email interview.

Scala’s interoperability with Java (it runs on the Java Virtual Machine) means the language meshes with the Java-based development environment and libraries Android uses, say the executives. They also cited support in the Scala toolchain for building Android apps, pointing to the Android plugin for Scala’s Simple Build Tool (sbt).

“Finally, like Java itself, Scala is statically typed,” note Fisher and Bagwell. “That means it’s easier to optimize at compile time for constrained runtime environments, such as Android mobile devices.”

The F# language is also finding adherents in the mobile space.

Adam Granicz, chief executive officer at IntelliFactory, says his company, which offers F# consulting, development and training services, has heavily invested in applying F# to Web and mobile application development. The language offers a “significantly more effective way to develop Web and mobile applications than traditional mainstream technologies,” he says.

Users of the company’s WebSharper product, a Web and mobile framework built around F#, report ease of use and productivity gains. IntelliFactory, based in

Kiskunlachaza, Hungary, uses F# exclusively on all of its projects, including several enterprise-scale Web applications implemented with WebSharper, says Granicz.

But F# is “not only an exceptionally good fit to certain types of applications,” says Granicz, who notes that the language is “at least as well suited universally as C# or VB.”

He says F# and the functional style of programming produces less code than other methods.

“In most situations, we observe a two- to five-time drop in code size, and that clearly has a strong correlation to productivity and maintainability, even in the short run,” says Granicz.

Multicore, Cloud Implications
Functional languages facilitate parallelism, and programmers are now taking advantage of that for multicore software development. Scala’s combination of object-oriented and functional programming traditions make it a natural fit for “Java developers who face challenges in building parallel and concurrent applications that can effectively run on multicore hardware,” say Fisher and Bagwell.

“That applies to emerging mobile devices as well as desktops and servers,” say the Typesafe officials.

“We are routinely using F# asynchronous computations — a model that inspired the new async features in C# 5 — and various parallel extensions to implement multithreaded applications,” says Granicz. “These also carry over to Web and mobile development with WebSharper, with highly scalable back-end components and non-blocking user interfaces.”

Functional languages are also enlisted in cloud computing. Heroku’s cloud application platform, for instance, supports Clojure and, as of October, Scala. As for the latter development, Typesafe teamed with Heroku, a Salesforce.com company, to provide Scala support on the platform.

Industry Interest
Functional languages are attracting interest from a number of industries and lines of business. Granicz says groups within a diverse set of industries employ F#. He says some groups are less open about their usage than others, as they consider F# to be a competitive advantage.

“We have worked with customers from a number of domains, including marketing, printing and health services, and are finding new connections to other industries through our Web and mobile technology,” says Granicz.

At Typeface, Fisher and Bagwell say that the company’s customers include financial services firms and large-scale Internet companies — organizations known to be early adopters of Scala. But, overall, customers represent a variety of companies that use enterprise Java today, they add.

Photo: @iStockphoto.com/loops7