[Catalyst] Re: Controllers vs Models

Justin Tocci jtocci at tocci.org
Mon Jun 6 20:10:34 CEST 2005


>> Actually I'd rather see the rules in a simple file than in the  
>> database.
>
> Out of curiosity, why?  It is easier to attach metadata to the  
> rules in a DB.

Seemed easier to me since its what I'm used to. You are right though.  
It may in fact be easier to put them in the database and query for  
what you're looking for.

> Ok, two points:  1) 'strictly generic reusable objects' are  
> useless.  Only when something acquires a certain degree of  
> specificity does it become useful.  I'm not being sarcastic  
> here...think about it.  You can't have a 'strictly generic'  
> document that is useful.  Simply by putting words on the page, you  
> give it some sort of specificity (is it a report? a novel? a  
> play?), and that specificity is what makes it useful.  The trick is  
> deciding what your universe of discourse is for this object and  
> then making it as reusable as possible within that universe.
>
> 2) I think you should review the Template Toolkit docs (http:// 
> www.template-toolkit.org).  The difference between TT and what you  
> are looking for seems to be that, instead of having the templating  
> engine know how to fill in variables and evaluate code, you want  
> that knowledge to be in a separate file.
>
> Right now, you can do something like this in TT:
>
>     [% title %]
>
> And that will be replaced with the contents of the 'title'  
> variable.  It sounds like you are saying that you don't want this  
> kind of directive in the template...that you would rather the  
> template had some actual text there which would be magically  
> replaced by the business rules.  If this is true, how do the  
> business rules know where the title begins and ends?

No no, I like the [% title %]; I want the [% title %]. I just want  
the logic for how to replace  [% title %]  with a value to be in a  
place with all the other similar logic.

> Also, how do you see your rendering system being structured?  Right  
> now, the sequence goes like this:
>
>     - Apache (or other web server) receives request, passes it to  
> Catalyst
>     - Catalyst calls the relevant action, which happens to reside  
> in a View class, passing it certain context
>     - the action picks which template to use
>     - Catalyst renders that template, filling in appropriate values  
> from the context
>
>     Note that the only code you have to write here is the action.   
> Everything else is built into Catalyst.
>
>
> If I understand what you're saying, you want it to go like this:
>
>     - Apache (or other web server) receives request, passes it to  
> Catalyst
>     - Catalyst calls the relevant action, which happens to reside  
> in a Controller class, passing it certain context
>     - the Controller loads certain business rules (from cache or  
> from disk)
>     - the Controller selects which View should be used
>     - the Controller passes the request to the View, along with  
> context and business rules
>     - the View chooses the template
>     - the View populates the template based on the business rules  
> (or would this still be done by Catalyst?)
>     - Catalyst renders that template
>
> Is this right?

I am very sorry. As far as how it should go, its over my head. I was  
hoping someone would say: "its already there, just do this... "

> Thanks.  I didn't go to college as an English major for nothing,  
> you know--I payed thousands and thousands of dollars!

:-)

> And there you see the prime problem with RBP: getting the  
> priorities right.  This was a tiny example...try to imagine what  
> it's like in a system with thousands or tens of thousands of  
> rules.  My last two corporate jobs involved engines that did RBP  
> (one was for natural language processing on classified ads, the  
> other was for financial software).  Both were nightmares.

I see, well, one man's nightmare is another man's dream!

> Just to be fair...I'll warn you that I worked with CLIPS in college  
> (long, long ago) and it drove me insane.  You Have Been Warned. :>

I'll keep a safe distance. Thank you.  ;-)

justin




More information about the Catalyst mailing list