[Catalyst] Re: Shoot out -- Catalyst / RoR / Other MVC apps --

Dave Rolsky autarch at urth.org
Thu May 10 03:02:00 GMT 2007


On Thu, 10 May 2007, Adam Clarke wrote:

>> I think there's a name for tha pattern I'm using, but I can't remember it 
>> or find a good reference online.
>
> Would that be the factory method pattern?
>
> http://en.wikipedia.org/wiki/Factory_method_pattern

I don't think it's really a factory. That would more like "give me an 
appropriate locker object for my OS/filesystem/whatever". Generally, a 
factory is used when you have a bunch of subclasses to choose from, and 
you don't want the caller to have to pick one explicitly.

Maybe what I'm doing isn't a pattern, exactly, it's just a design choice. 
Rather than putting lots of methods into Catalyst objects, I'm adding 
minimal hooks to the Catalyst core objects, and those hooks return objects 
with more methods.

It's kind of a pattern for plugins, which might be summarized like this:

* A plugin can add _one_ method to _one_ core class - Context, Request, or 
Response in this case
* The method added should return an object of some sort, with a 
well-defined API

This is as opposed to the historical Catalyst plugin pattern of "jam a 
gazillion methods into Context" ;)


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/



More information about the Catalyst mailing list