3 ms·
> Perhaps FP and OOP are not meant to be unified. The only thing that keeps FP and OOP from integrating properly is the "Everything is an Object" mentality. Pu
by pdpi 10y ago
> Perhaps FP and OOP are not meant to be unified.
The only thing that keeps FP and OOP from integrating properly is the "Everything is an Object" mentality. Pure-data structs aren't objects, and you start making loads of weird compromises when you force them into an object-shaped hole. Java (and, I guess, C++) kind of pushes classes as better structs, and lots of bizarre problems come from there.
I find that, when I'm programming in the small, on the lower-level implementation details, FP design principles serve me best. Inversely, when thinking about the structure of my applications, OOP principles suit the problem better.
This sort of design is what leads some people to say that Erlang is the most OOP language out there — Erlang processes map very naturally to objects in this sense, and it is, obviously, a functional language through-and-through.
- mafribe 10y agoThe only thing that keeps FP and OOP from integrating properly is the "Everything is an Object" mentality. Actually ... in Scala everything is an object. Functions are special cases of objects. That's Scala's great insight and it reverses what people used to think: everything is a function, and OOP is a special case of FP (this is e.g. OCaml's idea). If you look at Scala's foundations (DOT -- the dependent object calculus) this becomes pretty clear. Could you be referring to the difference between pure programming and stateful programming? Note that OO can be done in a pure way.