Fat models, skinny controllers and the MVC design pattern

It’s a bit tough to give you the “right” answers, since some of them deal with the specifics of the framework (regardless of the ones you are working with).

At least in terms of CakePHP:

  1. Yes

  2. Anything that deals with data or data manipulation should be in a model. In terms of CakePHP what about a simple find() method? … If there is a chance that it will do something “special” (i.e. recall a specific set of ‘condition’), which you might need elsewhere, that’s a good excuse to wrap inside a model’s method.

  3. Unfortunately there is never an easy answer, and refactoring of the code is a natural process. Sometimes you just wake up an go: “holy macaroni… that should be in the model!” (well maybe you don’t do that, but I have :))

Leave a Comment