2 ms·
For me is hard to understand the opposition of OOP to functional. They are just not exclusive one of each other, neither is exclusive with all other paradigms.
by f1shy 2y ago
For me is hard to understand the opposition of OOP to functional. They are just not exclusive one of each other, neither is exclusive with all other paradigms.
- mejutoco 2y agoOOP puts state and behaviour togethet (tightly coupled) in objects. FP, in a language with expressive types, has well-defined data-only structures (types) and functions that operate on those structures, so state representation and behavior are separated. For me, OOP can be done right, but FP is intrinsically better for correctness (it incentivizes correctness)
- whstl 2y agoOOP puts data and behavior together in objects. Which is 100% compatible with functional programming. It is mutability that is incompatible with FP, but mutability is a property of imperative programming, not of OOP. It is even possible to have 100% purely functional Java, for example, if you just eschew mutability.