[Catalyst] catalyst tutorial: MyAppDB/Book.pm vs. MyApp/Model/Book.pm

Matt S Trout dbix-class at trout.me.uk
Tue May 15 22:58:55 GMT 2007


On Tue, May 15, 2007 at 12:56:43PM -0700, mla wrote:
> Matt S Trout wrote:
> >On Tue, May 15, 2007 at 03:47:57AM -0700, mla wrote:
> >>So with that design you'd get the centralized validation, which
> >>is most critical to me, but then you could use SQL freely
> >>and get back a collection of read-only active record objects
> >>if you did fancy stuff.
> >
> >You -can- pass a custom chunk of SQL to DBIC for the where clause and have
> >it Just Handle It. The fact that most people choose not to is, however, a
> >hint as to where the better engineering practice lies :)
> 
> Why is that the better practice?

Because that's how the entire thing's -designed- to work.

Note I did -not- say that DBIC was better engineering than well-encapsulated
custom DBI code - but if you're using an abstraction layer, where possible
you should work with the abstraction layer, not against it. All abstractions
leak eventually but encouraging people to make them leak intentionally and
without good reason (which is what the AR practies you describe seem to do)
just seems wrongheaded to me.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Catalyst mailing list