[Catalyst] "Fat Model" Methodology?
rodrigolive at gmail.com
Thu Jan 21 18:36:37 GMT 2010
On Thu, Jan 21, 2010 at 6:37 PM, Jeff Albert <jralbert at uvic.ca> wrote:
> or should I create a separate =91application object=92 model which brokers
> requests from the Controllers and uses the DBIC model to implement them if
> they fit the application=92s logic? I=92ve looked far and wide to try to =
> understand how this pattern should work, since I can see the benefit of t=
> better code reuse and easier maintenance it would entail; I just need some
> advice to get me started. Suggestions?
> Jeff Albert
> jralbert at uvic.ca
I personally try not to put logic in the DBIC schema classes, because I use
Moose features, such as roles, extensively. Hence I end up having many Moose
classes (ie Employee.pm) that look just like their underneath DBIC schema
class (ie Schema/Result/Employee.pm). The Moose class will implement all
complex calculations and validations, and proxy for the bare basic DBIC one.
The decoupling is certainly beneficial, but the attribute redundancy bugs me
So ideally I would like to have DB entities represented by a single Moose
class, rather than in 2 or more places. For that there's KiokuDB and
MooseX::NonMoose-- the latter should allow a moose class to inherit from a
DBIC class. Haven't tried neither, though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst