Hands-On Reactive Programming with Python
上QQ阅读APP看书,第一时间看更新

What is functional programming?

Functional programming is a programming paradigm that has gained a lot of popularity since 2010. In the last few years, many functional frameworks or libraries have appeared in many programming languages, and functional languages have seen a rise in interest. Functional programming is not a new programming paradigm, but getting into it from a theoretical perspective can be intimidating.

The world of functional programming is full of new terms (such as monoid, monad, currying, purity, and higher-order function) that can seem difficult to comprehend, and some of them come with different definitions depending on the source of the information. But functional programming has some very interesting benefits:

  • Functional code is deterministic, with behavior that can (at least in theory) be proven
  • Functional code can isolate side effects from the pure program logic
  • Functional code makes testing easier

The good news is that one does not have to study functional programming in depth in order to benefit from this paradigm, nor to use a functional language. Many modern programming languages support some functional features and allow you to write functional code. So, it is possible to get the benefits of deterministic code and easier testing by only using some of the elements of functional programming.