Unlike any object-oriented programming language where everything is represented through an object, functional programming starts thinking everything in terms of functions. OOP and FP are not mutually exclusive. While OOP focuses on code maintainability and reusability by encapsulation and inheritance, functional programming, unlike state-oriented imperative programming, is focused on value-oriented programming, which considers computation as a pure mathematical evaluation and avoids mutability and state modification. When working with OOP, one of the challenges is that the object we have created can bring many extra properties or methods along with it whether or not we are using it in a particular case. Here are the three key characteristics of functional programming:
- Immutability
- Pure functions and referential transparency
- First...