[Catalyst] Basic Background Question, DBIx::Class

Rob Brown rob at intelcompute.com
Sun Feb 5 12:25:31 GMT 2012


Excellent, thanks a lot, great to know I wasn't going off on a tangent.


-----Original Message-----
From: Jason Galea <lists at eightdegrees.com.au>
Reply-to: The elegant MVC web framework <catalyst at lists.scsys.co.uk>
To: The elegant MVC web framework <catalyst at lists.scsys.co.uk>
Subject: Re: [Catalyst] Basic Background Question, DBIx::Class
Date: Sun, 5 Feb 2012 22:15:26 +1000

Hi Rob,


from the google cache
for http://wiki.catalystframework.org/wiki/necessarybackgroundknowledge


"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..


cheers,


J




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/


_______________________________________________
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/




More information about the Catalyst mailing list