It’s all about composition.

Although functional programming has constantly been gaining popularity in the past few years, there is still much misconception and prejudice about it. Many people understand the term very superficially or don’t understand it at all, and still claim to have adopted the way.

Most people never realize that functional programming is something more than just a set of new methods to write computer programs. It goes deeper even than the restrictions imposed upon value assignment and immutability, which makes our programs, sometimes, a little more difficult to write, but a lot easier to read and comprehend. In fact functional programming is a very different approach to programming, a different way of thinking about problems and expressing solutions.

So what exactly is functional programming? In procedural (and object-oriented) paradigm one thinks about their program as a sequence of steps that need to be taken in order to reach a certain goal. Input to the program is usually bound to a variable name, then some operations are executed on that variable and after execution is done, the final value of that variable becomes the result of the program. Let us illustrate this with a simple example implementation of factorial function in JavaScript.

On the other hand functional approach is to think about data being transformed rather than actions that our program executes. A factorial function might as well be implemented like so:


Ta strona wykorzystuje pliki cookies. Korzystanie z witryny bez zmiany ustawień przeglądarki internetowej dotyczących cookies oznacza zgodę na ich zapis i wykorzystanie. Więcej informacji można znaleźć w Polityce Cookies.

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.