3 ms·
I normally like what "Uncle Bob" has to say but I do not agree with a lot of what he says in the article. > Objects are bags of functions, not bags of data. T
by bcheung 8y ago
I normally like what "Uncle Bob" has to say but I do not agree with a lot of what he says in the article.
> Objects are bags of functions, not bags of data.
That might be an ideal case, but it is not reality. Pretty much every OO language has both of them combined.
> Is there really so much difference between f(o), o.f(), and (f o)? Are we really saying that the difference is just about the syntax of a function call?
Yes, there is.
Try doing a compose function with the OOP / member expression syntax.
Here it is in JS using FP syntax:
const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))
It would be even shorter in Haskell.
Try doing long division with Roman numerals.
Syntax is the structure behind mental representations and mental representations have tremendous power in expanding the physical limits of thought in the brain.
> The overriding difference between a functional language and a non-functional language is that functional languages don’t have assignment statements.
The overriding difference between FP and OOP languages is that the unit of composition and abstraction is the function or object, respectively.