On Thu, Jan 21, 2010 at 9:37 AM, Jeff Albert wrote:
Hi List!

I?m a new-ish Catalyst developer, converted from the ranks of the
HTML::Mason faithful, and the recent nature of my dedication to MVC design,
and to Catalyst?s fat-model pattern specifically, has left me with some
questions that I hope you folks can help me with. I?m trying to understand
how I would go about moving my application?s business logic, which seemed at
first glance to fit quite logically into Catalyst?s Controllers, into the
Model. Specifically, in this case I?ve got a Catalyst::Model::DBIC::Schema
model to obtain my application?s data from; should I try to implement my
business logic in that model (and if so, where? In the DBIC model PM? In the
schema definitions?), or should I create a separate ?application object?
model which brokers requests from the Controllers and uses the DBIC model to
implement them if they fit the application?s logic? I?ve looked far and wide
to try to better understand how this pattern should work, since I can see
the benefit of the better code reuse and easier maintenance it would entail;
I just need some advice to get me started. Suggestions?

Much in line with the other replies (especially hdp's), I tend to
create composite modules that do the work if it spams multiple
objects. If they only modify the DBIC class itself, or a direct
relation, I put the logic in the ResultSet/ResultSource package. This
usually ends up with those methods being called by the higher-level
module, though.

For the non-DBIC-based packages, I then use either
Catalyst::Model::Adaptor or InstancePerContext, and in creating the
instance I pass in the connected schema.

This allows for some flexibility and doesn't impact things like unit
testing outside of Catalyst.


Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 7 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJan 21, '10 at 5:37p
activeJan 22, '10 at 8:31p



site design / logo © 2022 Grokbase