[LRUG] Embarrassing Newbie question

Richard Livsey richard at livsey.org
Mon Aug 13 17:45:20 PDT 2007


I may be on the far side of sober at this point so take my viewpoint
with even more of a pinch of salt than usual, having just come back
from LRUG (1 pint and I'll go home, yeah ok...)

Model to Controller mapping often works quite well, personally I find
the RESTful way of looking at things a good way of reassessing the
data model. Sometimes this can work well, sometimes it might not, it's
always a good time to take a pragmatic look at your application and
see how it transposes onto the data model.

For example, on a current application we have users, accounts and
users that belong to those accounts.

We have User, Account and AccountUser models to map this relationsip,
should we have a UserController, AccountsController and an
AccountUsersController to manage this? The answer is yes, no, maybe.
See how it maps onto your application, allow this time to see if you
should go one way or the other. The thought process alone brings with
it enough benefits even if you end up not going down the route of 1:1
mapping.

Fat model, skinny controller is the way to go. But what you put in
each model, in each controller, is for you to decide and depends on
what you're doing.

So as always in a should I do X or Y question, the answer is that you
should do X, or Y, but know the reasons you are doing either.

</useless post>

-- 
Richard Livsey
Head of Agile Development, CitySafe
http://citysafe.org
http://livsey.org


On 8/13/07, Roland Swingler <roland.swingler at gmail.com> wrote:
> One thing to bear in mind is that your "cases of more complexity" may
> well end up being in the model layer, but not being ActiveRecords -
> not all your models need to be persisted. This fits well with the
> current view of "Fat Model Skinny Controller" (google for discussion),
> whereby the controller is really just allowing consistent,
> 'resourceful' HTTP access to your application model.
>
> Cheers,
> Roland
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



More information about the Chat mailing list