3 ms·
The problem with concerns is that they don't actually break down the god classes, they just separate the pieces of the god class into different files and combin
by djur 13y ago
The problem with concerns is that they don't actually break down the god classes, they just separate the pieces of the god class into different files and combine them at runtime.
The important metric here isn't "wc -l app/models/god.rb", it's "God.public_instance_methods.length".
- grey-area 13y agoYou don't have to use them for that, you can use them for composing models out of shared bits of functionality, for example 5 of your models have a status - put all the code about statuses in one place in a concern and include Status in your models, and possibly similar for controllers - this cuts code duplication. There is also an argument for making models smaller by splitting some of their functionality into modules too (what you're talking about), but I think that's a weaker case - better to use concerns for shared code.