DEV Community

Discussion on: Learning Functional Programming

kspeakman profile image
Kasey Speakman • Edited on

I would think so, yes. You find that most Smalltalk-inspired OOP advocates tend to view sharing of data as a bad thing. Instead, data is private to an object, and you just tell the object what you want it to do (by sending it a message or invoking a method). The object then induces local mutations to itself. It's still not technically a pure function, but this flavor of OOP follows the spirit of not mutating a shared external state. Because that's what makes programs hard to change over time.

A pure function has additional benefits like thread safety.

Thread Thread
vasilvestre profile image
Valentin Silvestre

Ahah thread.. I'm doing PHP :(