Four Paradigms of Decomposing Problems
-
Procedural: C, Pascal, Unix shells;
-
Declarative: SQL;
-
Object-oriented: Smalltalk, Java;
-
Functional: Haskell;
Relations of FP and OOP
Functional programming can be considered the opposite of object-oriented programming. Objects are little capsules containing some internal state along with a collection of method calls that let you modify this state, and programs consist of making the right set of state changes. Functional programming wants to avoid state changes as much as possible and works with data flowing between functions."
--From Functional Programming HOWTO
I think the lack of reusability comes in object-oriented languages, not in functional languages. Because the problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.
--Joe Armstrong (the creator of Erlang) discussed in "Coders At work" about the reusability of Object-Oriented Programming.
To be fair, in my opinion it's not an intrinsic problems of OOP. You can write OOP code which is also functional, but certainly:
-
Typical OOP tends to emphasize change of state in objects.
-
Typical OOP tends to impose tight coupling between layers (which hinders modularization).
-
Typical OOP mixes the concepts of identity and state.
-
Mixture of data and code raises both conceptual and practical problems.
-- Ruby Functional Programming
Rich Hickey, the creator of Clojure (a functional Lisp-dialect for the JVM), discusses state, values and identity in excellent talk.
If we can do functional programming with Python, do we need a specific functional programming language?
http://programmers.stackexchange.com/questions/42986/if-we-can-do-functional-programming-with-python-do-we-need-a-specific-functiona