3 ms·
I tend to use Clojure on a day-to-day basis. The functionality that OOP groups into classes is separated out into individual tools in Clojure, so you have a too
by weavejester 13y ago
I tend to use Clojure on a day-to-day basis. The functionality that OOP groups into classes is separated out into individual tools in Clojure, so you have a tool for inheritance, a tool for polymorphism, and so forth.
When you use the tools of OOP separately, you start to appreciate how little you actually need them. A program in a functional programming language will use very little mutation. Polymorphism is a little more common, but not by much. Inheritance is practically never useful - I've only seen one case where it's ever been used outside a OOP language. I have yet to find a case where I'd need all three tools simultaneously.
Encapsulation is also something that seems to have far more disadvantages than advantages. It sounds like a nice idea, hiding your data structures behind an API that doesn't need to change, except in practice it doesn't save much refactoring, and you lose all the benefits with working with data.