3 ms·
Can anyone double-check my interpretation of this? Good fat model design: break up units of behavior and related variables into modules, and include them in th
by Groxx 15y ago
Can anyone double-check my interpretation of this?
Good fat model design: break up units of behavior and related variables into modules, and include them in the model. Few people actually break them up, but that's unrelated to what's "good". Advantages: related behavior is encapsulated, likely in separate files, and methods are always available down the pipeline. Disadvantages: huge numbers of methods at any given time.
DCI design: .extend those modules into the models as you need them. Advantages: related behavior is encapsulated, likely in separate files, and code is declarative about what it intends to be used for and cannot be used otherwise. Disadvantages: have to new.extend(YourModule) every time.
If that's the case, I can see the advantage around guaranteeing things aren't using it outside of the controller-declared intended usage. More controllable / predictable code, basically. But breaking things into modules is a good idea anyway, regardless of if people actually do so, and aside from the increased control I don't see how this is different than module-including models.
Better, I'll admit, but they seem to be claiming ponies and rainbows that'll knock your socks off, when what they're offering is just a style choice (many modules per model) + per-instance mixins rather than per-class, which seems to imply to me that they're allowing a lot more manipulation of the models further down the rendering pipeline than is generally recommended in MVC.
- knewter 15y ago>> which seems to imply to me that they're allowing a lot more manipulation of the models further down the rendering pipeline than is generally recommended in MVC. Of note, is that the inventor of MVC is also the inventor of DCI. Consequently, I think you'd agree that perhaps he didn't agree with you :)