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

David Storrs dstorrs at dstorrs.com
Thu Aug 11 16:40:41 CEST 2005


On Aug 11, 2005, at 10:21 AM, Perrin Harkins wrote:

> On Thu, 2005-08-11 at 00:13 -0400, David Storrs wrote:
>
>> As to MVCR...you know, that's a really good point.  All this
>> confusion about where the business logic goes should be a big red
>> flag saying that it does not properly fit in /any/ of the three
>> locations.
>
> It fits just fine.  The original definition of "Model" is basically  
> the
> business logic.

My point is that the definitions seem to have changed, and therefore  
our approaches may need to change.


>> What are people putting in actions of their View classes?
>> Just a $c->stash->{template} = 'xyz.tt'; line?
>
> I would not expect to see anything more if you use TT.  If you use a
> system like HTML::Template, you would need additional code there when
> you want to do things like format dates or split data into two columns
> for display.  Those things are not part of the model because they are
> purely about the display of the data.

Makes sense.  Good reason to use TT, IMO.


>> What about the Controller?  Personally, I have chosen to put my
>> business logic in the Controllers, so their actions tend to be big.
>
> That's fine.  Other systems have different names for it, but the code
> amounts to the same thing.  The next step from this is to pull the
> business logic into action classes that are separate from the web-
> related code so you can use them from outside of a web environment.

My question was really aimed less at seeking approval and more at  
hearing what people are doing, so that we could discuss the pros and  
cons and move towards a 'best practices' consensus.  I'll ask more  
directly:  Perrin, what are you putting in your Controllers?


> The names are not that important.

I disagree.  Names are symbols.  The human brain is very good at  
manipulating symbols, but it only gets good results if you choose the  
right symbols to work with.  If you've ever read Orwell's 1984 you'll  
remember the whole rationale behind Newspeak: people cannot work with  
concepts that they don't have language for.  Likewise, it's hard to  
get clear and accurate results when your language is imprecise or  
confusing.

--Dks




More information about the Catalyst mailing list