Vivek Haldar

OOP = FP?

Alan Kay’s vision of object oriented programming was very different than that embodied in today’s popular OO languages such as Java and C++. One of his central goals for objects was immutability:

Though OOP came from many motivations, two were central. The large scale one was to find a better module scheme for complex systems involving hiding of details, and the small scale one was to find a more flexible version of assignment, and then to try to eliminate it altogether.

The last thing you wanted any programmer to do is mess with internal state even if presented figuratively. Instead, the objects should be presented as site of higher level behaviors more appropriate for use as dynamic component…It is unfortunate that much of what is called “object-oriented programming” today is simply old style programming with fancier constructs. Many programs are loaded with “assignment-style” operations now done by more expensive attached procedures.

(emphasis mine)

In this sense, the object-oriented school of thought is very close to functional programming. This is hard to believe, given how common mutable state is in the way OOP is practiced today. When was the last time you saw a class without a raft of setter methods?

Somewhere along the line, imperative-ness perverted the object-oriented paradigm.