Expressive Class Hierarchies through Dynamically-Instantiated Support Objects | Fullstack Ruby
24-May-2024 484
When you’re designing an abstract class for the purpose of subclassing—very common when looking at the framework/app divide—it’s tempting to want to throw a whole bunch of loosely-related functionality into that one parent class. But as we all know, that’s rarely the right approach to designing the models of your system.So we start to reach for other tools…mixins perhaps. But while I love mixins on the app side of the divide, I’m not always a huge fan of them on the framework side. I’m not saying I won’t do it—I certainly have before—but I more often tend to consider the possibility that in fact I’m working with a cluster of related classes, where one “main” class needs to talk to a few other “support” classes which are most likely nested within the main class’ namespace.
Expressive Class Hierarchies through Dynamically-Instantiated Support Objects | Fullstack Ruby #ruby #rubydeveloper #rubyonrails #Expressive #Class #Hierarchies #through #Dynamically-Instantiated #Support #Objects #Fullstack #class https://rubyonrails.ba/link/expressive-class-hierarchies-through-dynamically-instantiated-support-objects-fullstack-ruby