You are here: Home » Introduction into functional programming » Introduction

Introduction into functional programming

Introduction

Many articles can recently been read about functional programming and topics like “closures” and “lambdas”. I would like to understand how functional programming can improve real-world applications (going beyond implementing the factorial function which is often used to introduce functional programming, but which is seldom the kind of code you require in enterprise applications), so lets have a closer look to functional programming.

Now, what is functional programming at all? Primarily, it is a programming paradigm, like object oriented programming, imperative programming or declarative programming. Likewise, it has its own set of concepts - where, for example, in Object Oriented Programming, there are concepts like classes, instances, inheritance, polymorphism, encapsulation and more, in functional programming the concepts are among others side-effect free functions, recursion, treating functions as first-class objects (allowing functions to be passed to other functions as parameter), lambda expressions and closures. Historically, the functional programming theory is based on the Lambda calculus, this is also the reason that the word “Lambda” is found very often when reading about functional programming. A lot of the concepts from functional programming arose from mathematical concepts. While functional programming already existed for many years mostly in academic environments, it recently becomes more popular also in the industry.

Some functional programming concepts have been added to existing (e.g. object oriented) languages. Some other languages are more purely functional programming languages (while, partially, still contain concepts from procedural or object oriented languages), like the Lisp programming language family (Common Lisp, Scheme, Clojure, and some more), Scala or Haskell.