3 ms·
> OOP and FP are not in opposition to each other. FP considers objects to be at different granularity than your typical OO language does. well FP purists would
by aikah 12y ago
> OOP and FP are not in opposition to each other. FP considers objects to be at different granularity than your typical OO language does.
well FP purists would argue that objects(a unit that has properties and methods, and can pass messages to collaborators)have states.AFAIK "pure FP" is about getting rid of states,using immutable datastructures, and describing operations on stateless units,rather than writing imperative code.
I personally believe that being a FP purist or OOP purist doesnt make sense.Both paradigms can work together thus be orthogonal and not in opposition.
- nickbauman 12y agoI agree in principle but your definition of an object is very limited, which is part of the problem. FP considers both a function and a closure are objects. Classic OO does not. This is part of what I mean about different levels of granularity.
- klibertp 12y ago> AFAIK "pure FP" is about getting rid of states Of course not. It's about making state be always explicit and about carefully controlling side-effects. Some state is going to be there always.