OOP and FP Compatibility
This cluster discusses the relationship between object-oriented programming (OOP) and functional programming (FP), debating whether they are orthogonal, mutually exclusive, or can be effectively combined in languages like Scala and OCaml.
Activity Over Time
Top Contributors
Keywords
Sample Comments
FP and OOP are orthogonal... You can have purely functional objects
OOP and functional programming aren't mutually exclusive.
Why would OOP and functional programming be at opposite ends of a spectrum?
OOP and functional programming are orthogonal -- you can do both ...
If functional programming were implemented as widely and abused as much as OOP is, would it really fare any better?
Functional has not much to do with object oriented. Scala for example is both functional and OO. I think you mean the competition between imperative and functional languages.
I reject the idea that this is an OO problem. These same problems would exist in the form of functional programming, except it would be "functions" instead of "methods"
No. Object-oriented programming is not about syntax but rather is a generalization of functional programming. Functions are objects too: they have a domain and codomain as fields and implement the return ane call methods.
Is it possible to have an OOP language which is also functional? Or is it impossible without imperative paradigms?
no it's not, because a key part of OO is encapsulation. You really do need a functional language with naked, fully introspectable types everywhere, for this to work effectively.