Is Functional Programming Going Mainstream?

Recent developments in the programming language world is indicating towards a wider acceptance of functional programming. It is not new, it has been actively used in the academia and in niche industries in form of languages like Lisp. But recently certain typical features of functional programming are available in the new-age general programming languages and are being added to the old ones.

What Is Functional Programming?

Functional programming is a programming paradigm where computing is done by evaluating expressions. It is based on the concept of Lambda Calculus in Mathetmatics, and the application of functions is a direct descendant of the calculus counterpart. It does not do anything other than computing. There is no change in state involved, which means that there is no storage and there is no sequential execution. In the functional programming world, these are in fact called side-effects of computing.

The functional programming languages rely on functions to enable evaluating of expressions. To be able to perform modular programming, there is a need for treating functions as first-class objects. This means, just like any object, a function can be created during execution of another function, or passed to other functions as parameters or even can be return values of functions – basically you can do anything with functions what you can do with normal objects.

John Hughes provides a comprehensive insight for modular programming using functional programming in his technical paper Why Functional Programming Matters (pdf). He explains that functional programming provides facilities like higher-order functions and lazy evaluation that work as glues between modules. They highly enhance modular programming and better reuse of modules. This results in smaller and readable programs that can benefit the software development world.


Functional programming carries certain features to enable better handling of functions. Functions that treat other functions are called higher-order functions. They can take other functions as input and even output a function. Functional programming languages also support closures, where the inner functions can access local variables of the outer functions. Also, to ease passing of functions as parameters a lot of functional programming languages support anonymous functions, where a block of code can be passed around. These anonymous functions are called Lambda functions in the mathematical and functional programming domain.

Recursion is actively used in functional programming for control flow. This especially visible in iterating logic, like processing elements in a list.

Another very typical feature of functional programming is Referential Transparency. It is a direct result of no side effects. An expressions evaluation is dependent only on itself, not on global state. This means that any function would always provide the same output if it was provided the same input. It not only improves isolates behavior of the funciton but also makes it easier to understand and use.

Functional Programming In Non-Functional Languages

While some of the features can be implemented in older languages, they are not very convenient. Here are some links which show how functional programming can be carried out in non-functional languages:

Recently there has been an advent of proposals to natively support some of the features for languges like C++ and Java. Dr Valentin Samko has put a proposal to include Lambda functions in standard C++. Gilad Bracha, Neal Gafter, James Gosling, and Peter von der Ahé have proposed adding Closures to Java (pdf). More interesting aspect is that the communities have not opposed them. Bill Venners speculates, but cites favorable incidents, about support for closures in Java. Considering that there are already efforts in C++ community these efforts will be well received.

The new-age languages, including scripting languages, like Python, Ruby, C#, Scala support a lot of features from the functional programming domain. There are common uses of functional programming languages like XSLT today. Recent developments like Linspire/Freespire adopting Haskell, a pure functional language, for its core have highlighted application of functional programming in today’s software engineering. Does this mean that functional programming is being slowly accepted in the mainstream?

If this happens, it means a huge paradigm shift for the designers and developers. Functional Programming is going to sound Greek to any developer who is experienced in imperative or object oriented programming. It is not very easy to understand the concept of evaluating expressions or lambda functions without a mathematical background. In the beginning it might feel a little repulsive, but my suggestion, dig a little deeper and you will see the beauty. The industry itself will decide whether functional programming hits the deck or not, but its knowledge will definitely help you write better code.

Read more:

Discussion [Participate or Link]

  1. iface thoughts » Blog Archive » Learning Ruby said:

    [...] Ruby borrows some concepts from functional programming, like treating functions as first class objects and closures, lambda functions or anonymous functions. Though the concept was easy to understand, I had to make more effort to understand how to effectively use them. A programmer cannot ignore these at any costs, they form one of the foundations of some programming techniques in Ruby. [...]

  2. Tom Davies said:

    Another mainstream development is that Business Objects is using a Haskell-like functional language, running on the JVM, for some parts of their products: http://quarkframework.blogspot.com/

  3. Functors In Java on iface thoughts said:

    [...] A functor, also called function object is an object that encapsulates a function or an expression. It is commonly required for functional programming style. It can enable higher order functions and internal iterators. The C++ Standard Template Library (STL) uses functors quite frequently and helps in creating them. The Wikipedia article has more information about functors for other languages. [...]

  4. The First Program, The Biggest Block on iface thoughts said:

    [...] are learning new programming languages. It was not very straight-forward for me to understand the functional programming techniques after being so deep into the imperative programming way of thinking. However writing programs, [...]

  5. Programming Future | iface thoughts said:

    [...] We do not know yet, but there are more aspects of programming future that are being discussed. Is functional programming more suitable to handle scalability? Will multi-core programming be critical in future? Even if you [...]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.



Abhijit Nadgouda
iface Consulting
+91 9819820312
My bookmarks


This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.