+ 11
How is Functional Programming different from OOP?
Looking for a short straightforward comparison/evaluation
5 Answers
+ 14
ââââââââââJoe
This link is very good to know difference about fp and oop may be you got some info here.
https://medium.com/@sho.miyata.1/the-object-oriented-programming-vs-functional-programming-debate-in-a-beginner-friendly-nutshell-24fb6f8625cc
And Haskell is one of the fictional programming which is good to get start
http://learnyouahaskell.com/starting-out
https://medium.com/@naveenrtr/introduction-to-functional-programming-with-c-b167f15221e1
+ 6
Alan Kay, who had coined the phrase 'Object-oriented', states that OOP and FP are actually not that far from each other, and instead of being rivals they rather complement each other. Both approaches have shortcomings that are not properly solved in mainstream languages, even though the solution has been around for 60 years. This is quite a heavy read but I found very interesting
https://www.quora.com/Why-is-functional-programming-seen-as-the-opposite-of-OOP-rather-than-an-addition-to-it/answer/Alan-Kay-11?share=a52bda70&srid=s4tO
+ 4
In FP, everything is done via functions and there is no storing of a global state.
+ 3
I've just started to experiment with functional first languages, so my understanding is limited so take what i say with a grain of salt.
In OOP you organize logically related data into objects (classes). Objects store their own states in variables. Objects also have attached behavior, which are functions (methods) that specify how an object can modify its state.
In functional languages you don't have variables, what you have instead are values. You have simple values like for example the simple numerical value of 5 and you have function values (x+1) which in essence are procedures explaining what output to produce for a given input (lambda calculus). So in a functional language you build your program from values and value manipulations while in oop you build your app from objects which store behavior and mutatable state.
+ 1
in OOP every object stores it's values and everthing it needs or is related to it is inside of it.
i guess in functional programming everything is inside a giant melting pot
đ