The best thing about object oriented programming is Polymorphism, (ie executing different code depending on the type of the data).
The other other two “pillars” of OOPs are of more dubious value. Encapsulation encourages bad patterns of state management and mutation. Inheritance is just a flawed approach to composing code for reuse. The best approach to inheritance is to use it very sparingly.
Go has interface-based polymorphism, composition rather than inheritance, and limited encapsulation. So that makes Go closer to functional programming than Java or C++, right? trollface
LikeLike
It certainly makes it a language I’d be more inclined to want to use.
LikeLike
When I am making code for me, I use functional programming. When I am making code for money, I use OOP, because that’s what they want. Unless they say they don’t care, in which case I use functional.
LikeLike