Functional programming is not new.
takes the credit to present this idea formally in his 1977 Turing Award lecture. If
you are interested, a link to his paper
However, recently there has been a growing trend towards functional programming.
You look at the most popular big data platforms,
is creating an impact everywhere. Understanding the notion of Functional
and its application is quite a bit of work. The best method to understand the
Programming principals and the benefits is to learn a Functional Programming
and start using it.
However, this article is an attempt to simplify the learning curve and present the most useful concepts at a single place. Let's start with the most basic question.
What is Functional Programming?
There are disagreements about the answer to this question. However, at the most straightforward premise, here is the definition.
Functional programming is a way of writing software applications using only pure functions and immutable values.
The definition is straightforward, but It may take some time and practice to understand the real meaning and implications of this description. This definition is reasonably good, but it talks only about two things.
- Pure functions
- Immutable values
The pure function and immutable values are just two elements of the functional paradigm. There are many others and here is a list of top ten Functional Programming concepts.
Elements of Functional Programming
- Pure Functions and Side Effects
- Referential Transparency
- First Class Functions
- Higher Order Functions
- Anonymous Functions or Lambda
- Recursion and Tail Recursion
- Statements and Expressions
- Strict and Non-Strict (Lazy) Evaluation
- Pattern Matching
This list covers the most frequently referred elements. A high-level understanding of all these items is essential to building a sound understanding of Functional Programming. Even if you are planning to learn a Functional Programming language (for example Scala), a good understanding of these concepts is essential. A good understanding of these ideas should help you to relate and justify the language features and constructs. These concepts are also useful to understand and explain the answer to the next big question.
Why functional programming?
If you understand the benefits that these ten items bring to the table, you know
the answer to this question. The most significant
advantage of FP is that it brings a different approach and facilities to solve your
By the end of this article, you should learn many of those tools and the overall
So, with the stage set, let's take these Functional Programming elements one by one.
Pure Functions | Referential Transparency | Benefits of pure functions | First class functions | Higher order function | Anonymous functions | Immutability | Tail Recursion | Expressions in Scala | Lazy Evaluations | Pattern Matching | Closures