When to apply functional programming, and when OOP – experts answer

Each tool is good for a specific set of tasks in a specific situation. Just as some can hammer self-tapping screws with a hammer, fans of one or another paradigm with any input can use what they know better. However, experienced developers are still guided not by sympathy for any technology, but by efficiency. There may also be restrictions set by the customer or the software environment. A number of factors and characteristics of the developed solution, its further support are important. Of course, the choice is often based on their own experience, and at the very beginning of design it is not always possible to guess the future development and all the nuances of using software, so there is no universal solution.

Object Oriented Programming (OOP) is a more “traditional” paradigm. With its help, countless programs have been developed, including huge industrial systems in financial institutions, telecommunications in production, warehouses, and transport. Ignorance of the principles of OOP will actually block access to all these systems.

Here it must be understood that if OOP has been used for ten years, then consciousness adapts to this model, it is easier to design it through objects and method calls, and not through data streams and data. One of the main disadvantages of OOP is the monstrous, intricate class system for a system that has been developed by a large team for decades. As a rule, some “nuclear” classes are at the bottom of the model; nobody risks touching them even to the detriment of the speed of development and software stability. Successor classes, overridden methods, and other garbage appear, which over time also become the “core of the system.”

As for functional programming (FP). In some very simplified form, it is also used in OOP – in schools, the first programs are written by functions. You need to start learning programming languages ​​from it, and finish it with it. Further, depending on the needs of a particular project, it is possible to deepen the knowledge of the paradigm that is more used. The FP paradigm affects both programming and software design. For heavily loaded systems, moving to processing data streams can be a boon. To select this paradigm in a “large” system, at least you need to have a lot of data and a lot of work (many calls, many users). On the one hand, it can distance a business model from implementation, and on the other, it will allow it to respond in time to requests from users and other external systems. For small programs, the choice of FP is possible, it is more a matter of taste. However, it may not be easy for a newcomer to split a business model into data and data streams and design it so that the data is not stored in classes and there is a clean FI.

What to choose a beginner to study?

It will not be possible to learn everything at once, but for a quick start to a career, in my opinion, it is enough to know the principles of OOP and have at least a general idea of ​​functional, procedural languages: modern approaches use some older paradigms, in a new implementation they can be very effective. If there is a superficial knowledge of functional programming, this is generally wonderful. This means that the developer has a choice, fewer restrictions on the implementation of the plan.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *