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

David Storrs dstorrs at dstorrs.com
Thu Aug 11 16:10:14 CEST 2005


On Aug 11, 2005, at 9:43 AM, John Siracusa wrote:

> On 8/11/05 9:15 AM, David Storrs wrote:
>>
>> A very good case can be made for the idea
>> that the Model should be just a thin wrapper over the DB and that the
>> Controller (notice the name) should be the 'smart' thing in the
>> system.  Not everyone will agree with this view and it isn't the
>> classical MVC view but neither of those things makes it wrong.
>
> IME, tying any "base functionality" to your webapp is a mistake.   
> Take an
> online store, for example.  Consider these functions: logging in,  
> adding an
> item to the cart, deleting an item form the card, updating  
> quantities in the
> cart, adding a credit card, making a purchase, charging the credit  
> card,
> producing a receipt, logging out.  All of these functions should be in
> modules that have no ties whatsoever to the web or a webapp.
>
> What the webapp should do is provide a UI for these functions, and  
> add any
> business rules that may vary.  For example, while the underlying  
> module may
> allow any receipt to be viewed, the webapp would enforce a  
> constraint that
> only allows users to view their own receipts.


All true, but orthogonal to what I'm talking about.  Let's say you  
define your generic ShoppingCart.pm module. Some part of your MVC app  
needs to know which functions to call in ShoppingCart.pm--what I've  
been talking about is what part that should be, the M or the C.

--Dks



More information about the Catalyst mailing list