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. So the real problem stem
by nickbauman 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. So the real problem stems from the fixed granularity of the objectionable (heh) of typical OO languages leads to mutable state, which leads to unnecessary complexity.
In the end, typical OO leads to type systems which lead to noun discrimination which are ontologies, which reflect world-views. You don't want to get any of that on you. The more successful type systems stop at grouping aggregatable functions. Look at Go. Or Clojure. Those type systems are as good as it gets to me but I've never written a line of Smalltalk or Haskel, so someone set me straight on that.
- 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.
- codygman 12y agoA couple years ago at least, I know I had problems with writing type safe json handling code in Go. I believe my particular hang up was a place where I basically needed an enum.