Sunday, October 2, 2011

Re: Fat Model Skinny Controlller? Is this really correct?

Right principle but not a good example as a component would handle your situation (arguably) better. Fat models are more about centralising business logic within the actual models and letting controllers control the flow of the application by calling the right bits of logic at the right time.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 1 Oct 2011, at 17:05, Sam Sherlock wrote:

Yep that's a summary of my thoughts on fat models.

I think a good example of this is cakedc users plugin - updated last night along with a other cakedc plugins.

- S

On 1 Oct 2011 14:46, "badben" <ba.davies@gmail.com> wrote:
> I'm certainly no expert but my understanding is that the placing as much
> logic in the model as possible is the best way as many controllers can use
> the same model and often many controller methods save/edit/delete model
> data.
>
> For example, if you want to store a serializaed array into the db, if the
> logic to serialize the array is placed into the controller you would have to
> serialize the value everywhere that the model is saved. If you have ten
> functions in the controller that save the model then you would have to
> repeat the code ten times.
>
> However, if the code to serialize the array is placed in the model instead
> you only have to write the code once and can prety much forget about it from
> then on. Also when you come to refactor your code you only have to change
> the code in one place, not in every controller using the model
>
> It adhears to the DRY (Don't Repeat Yourself) principle and will make your
> life easier and hopefully less buggy.
>
> At least that is my understanding.
>
> --
> Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: