[Catalyst] Progress bar

Tomas Doran bobtfish at bobtfish.net
Wed Oct 17 20:20:10 GMT 2012

On 17 Oct 2012, at 15:54, Bill Moseley wrote:

> On Wed, Oct 17, 2012 at 12:34 AM, Tomas Doran <bobtfish at bobtfish.net> wrote:
> This needs a Catalyst release first - I was waiting till there were a few more changes for that, but if it's hurting people now, we could do a new version with just the tiny changes I made to support this.
> By the way, I wonder if it wouldn't be cleaner to use _build_request instead of a builder for the args.   In this case might have to completely override _build_request to inject in the cache -- or make the cache "rw" so that it can be set after _build_request.

No, and the explicit reason it's not cleaner is that 'rw' - would that we could change things so that the request object was constructed in it's final immutable form!

> Seems like giving the request the app as an attribute would be a bad idea, but not clear what that is. :)

Too much coupling! App has a request has an app - ARGH.

> I've been struggling a bit with hierarchy of classes where I need to pass child construction params down to child constructors.  I've added "parent" attributes to the child classes, manually passed args (as you are doing here), and even had separate config objects that I pass around.  Haven't found anything that I'm that fond of.

You should inject _just_ the dependencies that the class in question needs, having explicitly broken them out.

Passing the app down makes the app a 'god object'.

Why would you care? Well, Say you want to persist most session data into the DB, but you're happy with progress bars being in memcache - if you pass the cache explicitly to the request you can do this trivially, if you pass the entire $c or $app down to the request, you cannot do this at all.

Hope this helps!


More information about the Catalyst mailing list