3 ms·
I prefer fat models to fat controllers because methods in the controller are much more difficult to reuse than in the model. When models get too fat, I usually
by Jarred 14y ago
I prefer fat models to fat controllers because methods in the controller are much more difficult to reuse than in the model.
When models get too fat, I usually create modules that break up the bulk of the model into smaller chunks. Meaning, for example, if it has lots of validations, then maybe I'll move those validations over to a module and then extend/include the module back into the model. I haven't needed to use these modules in any other class, but less code in one place is usually easier to read than more code. If the language you're using isn't Ruby, then a module is basically a means of doing multi-inheritance.
Note though -- I didn't read the article