Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Catalyst: Using Chained for URL Dispatching and Sane Method Organization

by dreadpiratepeter (Priest)
on Oct 18, 2009 at 22:05 UTC ( #801904=note: print w/ replies, xml ) Need Help??


in reply to Catalyst: Using Chained for URL Dispatching and Sane Method Organization

Chained attributes are like crack. Once you grok them and start using them you can't stop. They simplify code so much.

I think you should stress what you have accomplished with your chained handlers more. Make it clear that the nbenefit is access to the entry object in all methods chained from blog without having to do the work. You imply it, but don't come out and say it. In other words you have a great magic trick but are missing the Ta-Da!



-pete
"Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."


Comment on Re: Catalyst: Using Chained for URL Dispatching and Sane Method Organization
Re^2: Catalyst: Using Chained for URL Dispatching and Sane Method Organization
by stonecolddevin (Vicar) on Oct 19, 2009 at 00:20 UTC
Re^2: Catalyst: Using Chained for URL Dispatching and Sane Method Organization
by metaperl (Curate) on Oct 19, 2009 at 13:57 UTC
    Chained attributes are like crack. Once you grok them and start using them you can't stop. They simplify code so much.
    I understand what chained attributes do. And Catalyst was a lot of fun to work with when it first came out. I would like to offer my viewpoint on solving the same problem. Personally, if you read what dhoss says chained attributes are for:
    Chained, however, allows you to chain together methods that need to share information across requests....
    Basically, in OO terms, what he is saying is that he has a sequence of methods that belong in the same class because they consume the same data. And if you look at the implementation:
    sub base : Chained('/') PathPart('item') CaptureArgs(1) {
    The use of the word 'base' is a dead giveaway.

    So, what I see here is the use subroutine overloading to give Catalyst hints about how to handle common object-oriented programming problems for you.

    I came up with a similar strawman example here.

    The big difference is that I used clean, standard class-based OO to create a base class and then allowed the derived class to share/refine behavior as needed.

    I personally dont like learning things like Catalyst and Template Toolkit. In my eyes, they are attempts to take what any OO Perl programmer can do himself and come up with syntactic trickery and shortcuts to make it easier for those who lack said sophistication.

    Just give me Moose, CGI::Prototype and HTML::Seamstress and the tried and true methods of OO programming which work in and out of Perl anyday over language-specific syntax games like this.

    But of course, we all have our preferences and I'm sure many people are getting great mileage out of Catalyst and Template, so more power to them!

    Thanks for the chance to offer a contrasting viewpoint.

      metaperl thanks for the review! It's nice to have non-Catalysters critique my work as well, even better if they *don't* like Catalyst so I can get a rather rigid review :-)

      Also, ++ to you for Moose-ing!

      mtfnpy

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://801904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-11-27 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (186 votes), past polls