4 ms·
Encapsulation is only really an issue if you don't follow the law of demeter. write better public facing methods if you want better Encapsulation. Inheritance
by morphicpro 6y ago
Encapsulation is only really an issue if you don't follow the law of demeter. write better public facing methods if you want better Encapsulation.
Inheritance is really just about writing better namespace and domain / contexts of your code.
Polymorphism is really only ever an "issue" I've seen when dealing with strong typed langs and all the langs where it has become an issue they provide interfaces to aid in Polymorphism.
I don't think anything about what was listed is #1 exclusive to OOP and 2 doest not already have best practices to address in OOP and other langs.
Everything that was written about was not about the problems they solved but the patterns used to address the problems. I think that makes it too subjective to be constructive.
I will say though there is nothing fun about mocking complex state in tests for a rails app let alone if that state is shared or easily mutated.