Question

One of the prime reasons for the increasing shift in attention towards functional programming these days is the rise of multithreading/processing and the advantages of FP's focus on side-effect free, stateless computation in making scalability effortless.

Certainly, though, in Object Oriented programming, we could also shift to a stateless paradigm, where all objects never get to mutate state. This can be a convention, or perhaps even implicitly supported by the language. For example, in languages that enforce uniform access between object fields and methods, simply not allowing setter methods would accomplish this.

My question is, then, since OO can utilize statelessness and nothing about objects mandates statefulness, is OOP effectively a superset of FP? Are there any additional advantages / features of FP that makes multithreading more practical than in OOP?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top