3 ms·
If the model gets big, it's an indication that it is doing too much work. You want every class in your system to have a single well-defined role--if the classes
by fusiongyro 14y ago
If the model gets big, it's an indication that it is doing too much work. You want every class in your system to have a single well-defined role--if the classes are getting huge it might mean that there's code duplication or it might mean that the class is taking on too much work.
In this context, DHH is pointing out that rather than duplicating the code for tagging and the code for managing visibility and the code for managing a Dropbox account on each class that needs these things you can use a Concern to abstract out each of those groups of functionality and then apply them case-by-case with one line of code. It's a pretty neat trick and used appropriately it looks like it would really help keep the model layer trimmed down to its bare essentials.
- Mz 14y agoOk. To me, that sounds kind of like what CSS does for HTML -- less code, faster page loading, that sort of thing. Is that about right? Thanks.
- fusiongyro 14y agoYes, basically. Less code? Yes. Cleaner code? Yes. Faster? Probably not detectably faster or slower.