# What Is Functional Programming?

Originally published at: https://www.sitepoint.com/what-is-functional-programming/

As a programmer, you probably want to write elegant, maintainable, scalable, predictable code. The principles of functional programming, or FP, can significantly aid in these goals.

Functional programming is a paradigm, or style, that values immutability, first-class functions, referential transparency, and pure functions. If none of those words makes sense to you, don't worry! We're going to break down all this terminology in this article.

Functional programming evolved from lambda calculus, a mathematical system built around function abstraction and generalization. As a result, a lot of functional programming languages look very mathematical. Good news, though: you don't need to use a functional programming language to bring functional programming principles to your code. In this post, we'll use JavaScript, which has a lot of features that make it amenable to functional programming while not being tied to that paradigm.

## The Core Principles of Functional Programming

Now that we've discussed what functional programming is, let's talk about the core principles behind FP.

You indicate at the end that FP is typically considered to be the alternative to (different from) OOP. In my opinion the definition of FP is very unclear. It helps to have a clear definition of it. Unfortunately this article does not make it clear to me and I think it is not possible to clearly define FP.

You say that FP evolved from lambda calculus. What feature of lambda calculus does not exist in non-FP? It will really help to know that to understand what FP is.

Functions can be impure whether they are used in FP or OOP. If that is not true then it will help to specify the difference.

How does non-immutability prevent multi-threading? More important than that, what is it about other paradigms or styles that prevents use of immutability?

Are first-class functions not possible in non-FP?

Are higher-order functions not possible in non-FP?

How does function composition differ from every other use of functions in programming?

The advantage of OOP is modular code, so I see no relevance to the definition of FP to say it leads to modular code.

I will be impressed if you can explain how FP differs from other paradigms or styles such as OOP with the clarification I suggest above.

I look forward to answers to these questions. Either from the article author, or, to give the author time and opportunity to respond appropriately, in a week or two from others.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.