[Solar-talk] controller helpers, maybe?

Andreas Ravnestad andreas.ravnestad at gmail.com
Mon Jul 9 11:16:32 CDT 2007


Paul M Jones wrote:
> On Jul 9, 2007, at 9:04 AM, Rodrigo Moraes wrote:
>
>> Hi,
>> I'm adding more and more helper methods to my base application
>> classes, and started to think in something like view helpers, but for
>> controllers.
>>
>> I've tested the idea following very closely Solar_View helper
>> implementation, and it worked so fine. :) It's all in
>> Tipos_Controller_Page / Tipos_Controller_Helper:
>>
>>    http://dev.tipos.org/browser/trunk/Tipos/Controller/Page.php
>>    http://dev.tipos.org/browser/trunk/Tipos/Controller/Helper.php
>>
>> Do you think this would be too much? Or maybe have other ideas to add
>> extra shared functionalities to controllers?
>
> You know, this is a really good idea.  We might want to call them 
> "plugins" instead of "helpers", if only to keep the vocabulary 
> distinct.  I can think of a couple situations I'm in right now where 
> this would help immensely.
>
> I would think these should be protected-access, not public-access, so 
> that a "Plugin_Foo" would be called with ->_foo(), not ->foo().
>
> Other thoughts?

Just a quick note about vocabulary - to me, the word "plugin" means 
something rather abstract, undefined, and very high-level that 
externally modifies default behaviour or provides something completely 
new (maybe like support for components.. :) ). I don't think I'd feel 
comfortabuls with calling this concept "plugins" since they typically 
won't really do all that much. This is based on my assumption that 
controller helpers will be pretty similar to view helpers in how they 
work and what they are intended for.

Further, as Rodrigo and I discussed (on irc as usual), it would be very 
practical to have these controller helpers available in associated views 
as well. In that case, it would make sense to distinguish them as 
"controller/action helpers", and "view helpers".
Well, it would to me, anyways :)

I don't want to start a debate about the color of this bikeshed though, 
so you name it what you like - I will still use it and be a happy camper ;)

As for visibility,what is the rationale for protected access? (now I'm 
playing the devils advocate;)

-Andreas


More information about the Solar-talk mailing list