--- On Wed, 4/22/09, [email protected] <[email protected]> wrote:

> From: [email protected] <[email protected]>
> Subject: Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
> To: "Simon Wilcox" <[email protected]>
> Cc: "The elegant MVC web framework" <[email protected]>
> Date: Wednesday, April 22, 2009, 10:47 PM
> Hello, Simon,
> 
>   Your points have good weight for thoughts. In fact,
> coming from many
> backgrounds pre-Catalyst and pre-MVC (ie many a times, the
> templating
> system ie Mason would do the job of both controller and
> view
> incorporating the business logic), I have been able to
> write regression
> tests to test methods within an ORM.
> 
>  When I first started using Catalyst, I looked at the tutes
> and so forth
> and it seemed to me that the only form of testing is just
> web based (ie
> using web robots like Test::WWW::Mechanize::Catalyst).
> Whilst that allowed a good test of the interface and
> functionality as a
> whole(akin a blackbox), I missed the days when I had to
> develop
> something without the web front end and have it work for
> both web and
> back end(ie via scripts).
> 
> 
>  Your arguments here have raised a direction for me to put
> my business
> logic into the model component of my app.
> Nevertheless, can I ask for some references to examples of
> business
> logic being written in the model? I can't seem to observe
> any from the
> Catalyst tutes.
> 
> thank you
> 
> K. akimoto
> 

I'd recommend taking a close look at some of the catalyst applications already 
on CPAN. You should be able to glean some info that way.  Current tutorials are 
geared to get people rolling.

check out

MojoMojo
Mango
AngerWhale

There's probably more, I just mentioned the ones whose source code I have 
examined as part of my learning process.

You can just search for those on http://search.cpan.org/  I'd give you the 
links as well but am on my blackberry and it's a hassle

John

> 
> Quoting Simon Wilcox <[email protected]>:
> 
> > On 22/4/09 23:03, [email protected]
> wrote:
> > > IMO the best place for your business logic is the
> controller.
> > 
> > Then you're wrong, at least in the eyes of many
> people.
> > 
> > http://en.wikipedia.org/wiki/Model-view-controller
> > 
> > The Controller is just a layer that converts the input
> to something
> > that 
> > can be passed to the Model and then sends the output
> back to the user
> > 
> > via a View.
> > 
> > You *can* put all your logic in the controller but
> typically you will
> > 
> > end up with two problems:
> > 
> > 1. Your app is tightly bound to a web framework and
> adding some other
> > 
> > sort of user interaction, or extending the application
> code elsewhere
> > 
> > becomes difficult, which is what started this thread
> isn't it ?
> > 
> > 2. It becomes hard to test as you need to have the web
> framework
> > running 
> > to run the tests. You should be able to test all of
> the use cases & 
> > business interactions outside of the web framework. If
> you can't,
> > then 
> > that's a code smell and an indicator that you have too
> much going on
> > in 
> > your Controller classes.
> > 
> > The Catalyst Model classes should really be a very
> thin shim over the
> > 
> > top of your DBIx::Class Schema objects which is where
> all the 'heavy
> > 
> > lifting' of the business process takes place.
> > 
> > Hope that makes sense,
> > 
> > Simon.
> > 
> > 
> > 
> 
> 
> 
> 
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
> 




_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to