Many of us have heard about Functional Programming paradigm and may have wondered what is the advantages of FP over well established Object-Oriented Programming?
Is it enough to know the basis of OOP and have at least a general idea of Functional Programming ?
It should be noted that each approach is good for a specific set of goals in a specific situation. Just as one can hammer the screws, the adepts of one or another paradigm with known efforts can use what they are familiar with better. However, professional software developers are still guided not by sympathy for any technology, but the speed of development, efficiency and speed of execution. There may also be some restrictions set by the company’s end client or the software development environment. Among mentioned number of influencing factors and requirements of the developed solution, its further support is also important. Of course, the choice is often based on programmer’s own experience, and at the beginning of the road it is not always possible to correctly guess the future development and all the caveats or use cases for the software, so there is no one-size-fits-all solution.
Object Oriented Programming (OOP) is a more “legacy" paradigm. With its help, huge amount of programs worldwide have been developed already, including serious industrial systems and financial bodies, telecommunications, retail, warehouses, shipping, production. neglecting of the principles of OOP will actually deny access to all the mentioned systems.
Here it must be clear that if OOP has been used for decades, the consciousness of all developers adapts to this model. Now it is simply easier to design software through objects, methods, properties, fields, and not through data processing streams and data. One of the main disadvantages of OOP is often enormous, huge system of classes for a software that has been developed by a large team for years. As a rule, there are some “atomic” class declarations laying are at the ceiling of the business model, so nobody ever risk touching them even to improve the speed of development and better software reliability. Useless classes, not needed overridden methods, duplicate code, and other garbage appear, which nobody touches and over time it becomes the "core of the system".
What Functional Programming (FP) approach is? In some very simplified form, it is also used for studying. The first programs of kids are written by functions. If you start start learning programming languages, you start by studying simple functional programming. Further, depending on the needs of a particular software project, it is possible to strengthen the knowledge of the chosen paradigm for the given purpose. The FP paradigm should be taken into account for both programming and software solutions design. For high-load servers or other systems, moving to processing byes data streams can be a pain. To select this paradigm in a "large" well-established system, at least you need to take into account that you have a lot of data and a lot of work (many calls from many users at once). On the one hand, it can distance a business model from actuial implementation, and on the other, it will allow to respond in time to requests from users and stakeholders. For small programs, the choice of FP is more a matter of taste. However, it may not be easy for a newbie to split a business model into data and data streams and design program so that the data is not stored in classes and everything will be following pure functional programming
So, modern approaches may use FP paradigm too so the newcomer should be studying too. If correctly implemented, the performance gain of FP can be very effective. If one has superficial knowledge of functional software programming, this is generally wonderful. This means that the developer has a choice, and fewer restrictions on the implementation of the plan.