3 ms·
Mutable state does not necessarily mean OOP. For instance, in Clojure I could write a multimethod that updates refs of type Student, and Course: (defmetho
by weavejester 16y ago
Mutable state does not necessarily mean OOP.
For instance, in Clojure I could write a multimethod that updates refs of type Student, and Course:
(defmethod assign [Student Course]
[student course]
(alter student update-in [:courses] conj course)
(alter course update-in [:students] conj student))
There is polymorphism and mutability here, but we're not dealing with objects.
So to rephrase my question: what are the advantages of OOP when dealing with mutable state?