MVCR pattern (was Re: [Catalyst] Bing!)

Adam Jacob adam at stalecoffee.org
Thu Aug 11 18:59:01 CEST 2005


On Aug 11, 2005, at 8:36 AM, David Storrs wrote:
>
> - Your exampe talks about putting all the code into separate  
> modules that are in no way attached to the web app.  The web app  
> would then provide an interface to these modules.
>
> - In a previous email, I agreed with you that this was the right  
> thing to do.  I said then, and I will say again now:  It is the  
> right thing to do.  It is also not relevant to what I'm asking.  My  
> question is /which component/ of the the web app should be  
> responsible for providing that interface to your external modules?   
> Should it be the Controller?  Should it be the Model?  Should it be  
> a special-purpose Action class that is not part of the canonical  
> MVC pattern?  Should it be some blurring of the above?

I would see this as being in the Model.  If I want to react to some  
event, passing user input/output to/from some external thing ("create  
crontab", "delete crontab", "add user data to database") I want that  
logic to be encapsulated in a Model, so that my Controller can ignore  
the details.

Now, assuming I have a non-catalyst set of libraries called Foo.pm,  
and I want to use the functionality in Foo from Cat::C::Whatever, one  
could argue that calling Foo directly from the Controller amounts to  
about the same thing as passing things through a small Model class  
that handles just the methods you desire.

Hrm.. now that I'm writing it, things do get sticky. :)

Adam




More information about the Catalyst mailing list