We work with two MVC frameworks: RobotLegs in Flash and RubyonRails on the
server.

RubyonRails mandates a "thin controller fat model" paradigm and we try to
user that in Flash as well.

Under this paradigm, wherever possible, things should be in the model. One
good reason for doing this is code reuse. The last thing you want to be
doing is putting the same thing in multiple controllers.

Where context matters, things need to be in the controller, but I usually
then have them call controller methods.

There are different ways of thinking about this, but this is how rails
mandates it and the pattern we follow.

No matter what MVC paradigm you follow, I think everyone would agree the
model is responsible for ensuring data integrity. Any validations etc.
should be in the model as part of the setter methods to ensure only
compliant data ever makes into your value objects / database.

When it comes to permissions we handle them at a controller level, but they
are centralised in a utility configuration. The system we use allows for
model based permissions as well but we find these are too limited as
context matters for permissions and it's hard to deal with this
meaningfully in the model.

On 16 February 2012 05:32, David Hunter <[email protected]> wrote:

> Hello list,
>
> If I am making an application with MVC pattern and calculations are needed
> to be performed on the data when the user interacts with the application,
> would you:
>
> do the calculations in the Model?
>
> create a separate class that handles the calculations and puts the results
> in the model?
>
> do the calculations in the Controller?
>
> looking forward to hearing people's thoughts on this,
>
> david
>
> --
> David Hunter
>
> www.davidhunterdesign.com
> +44 (0) 7869 104 906
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to