I am reading a book about Lambdas expression in Java and I came across this sentence
The difference is that object-oriented programming is mostly about abstracting over
data, while functional programming is mostly about abstracting over behavior.
Can anyone be kind and elucidate the difference that is mentioned in above sentence?
Source : http://shop.oreilly.com/product/0636920030713.do
The irony is that people can come up with infinite analogies when trying to compare FP to other paradigms.
In this particular case once you figure out what does "abstracting over something" means, you could solve the riddle.
Abstracting over something would mean you hide the details of that something and provide abstractions to access that something so that to the outside world the details of that something are not visible.
Applying the above theory we would get that:
In OOP you would hide the details of data and provide abstractions (interfaces, classes etc) to access the data.
In FP you would hide the details of behavior and provide abstractions (modules i.e a set of functions) to access the behavior.
I would have written it like "The difference is that object-oriented programming is mostly about relation and communication between real time objects,while functional programming is mostly oriented to the desired result."
When you are working in OOP languages, the given domain is usually very importent to you. On the other hand, with functional languages you do not care about the domain but only about the deterministic result which should be achieved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With