[Catalyst] Basic Background Question, DBIx::Class

Jason Galea lists at eightdegrees.com.au
Sun Feb 5 12:15:26 GMT 2012

Hi Rob,

from the google cache for

"Here is where the two schools diverge. The older school (popularized by
the Smalltalk language) holds that the *business* *logic* should go in the
Model. The younger school (popularized by recent web applications) holds
that the *business* *logic* should go in the Controller. Both approaches
work, and each has pros and cons. Which one you choose is more a matter of
personal mindset and preference than anything else: does it suit your
thinking better to have a smart Controller managing a thin database
connection (the Model), or a smart Model that is tracking the state of your
application and telling a thin request handler (the Controller) how to
process requests?"

I've ended up putting business logic in a Catalyst model, but keeping it
separate from the DBIx::Class model, basically building my app as
standalone and hooking it into Catalyst as a model (
http://lecstor.com/catalyst_fat_model.html). It's not perfect though..

If you search the list you should find more than a few related discussions..



On Sun, Feb 5, 2012 at 9:43 PM, Rob Brown <rob at intelcompute.com> wrote:

> Hi,
> I've recently jumped into Catalyst and DBIx::Class, and after following
> some tutorials, I am left with some controllers and a view which I'm
> completely happy with.
> The lib/Schema and lib/Model directories have me a little confused
> however.
> I have a single class in lib/Model, inheriting from
> Catalyst::Model::DBIC::Schema with some db connection details.
> Then the lib/Schema.pm class and dir, and Result classes for my db
> tables.
> I understand what they're all doing, but...
> Shouldn't I have classes in lib/Model/ for each of my tables/models?  Is
> this what the Schema/ classes should be doing?
> I'm used to creating set classes for each model in my apps, so just
> having the DBIx::Class ones is a little odd right now, with no REAL
> logic in them to model my app logic.
> I would have expected some basic wrapper model classes in lib/Model/ for
> each Schema/Result.
> Maybe a single class in lib/Model/ is correct, to model the entire DB,
> it just threw me a little.
> some feedback/direction would be great.
> Thanks,
> Rob
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120205/1db91=

More information about the Catalyst mailing list