What is Functional Programming?
Functional programming revolves around the idea that a program is made of a set of functions and they follow certain rules. It is a programming paradigm, meaning that it is a way of thinking about software construction based on some fundamental, defining principles. Popular programming languages that support functional programming techniques are Python , Ruby and many others.
Functional programming is a clean, robust alternative to the more typical procedural style of programming. The main concept of Functional programming is the idea of pure functions. Those are functions that take some input, operate on it and return an output without modifying any variables our state outside of the scope of the function. Every function that reaches out for the Document Object Model or uses variables that are not in it's scope is therefore considered impure and does not step up to the standards of functional programming.
Why Functional Programming?
- Its pure function, provides confidence of not changing things outside of its scope.
- Its reduces the complexity, need not to worry about how it is doing it, focus will be only on what it is doing.
- Ease of testing, because it does not depend on state of the application and result verification also will be easy.
- It makes the code more readable.
- Functional programming makes code easier to understand.