On Nov 6, 2007 8:10 PM, Gary Affonso <[EMAIL PROTECTED]> wrote:
> For some reason folks new to s2 seem to get it backwards and want to
> stuff a bunch of Action methods into a single Action class.

It's probably because the standard S2/WW validation workflow implies
that an Action class will have multiple methods that an application
will invoke in the normal course. Meanwhile, in Struts 1 there is a
"DispatchAction" that does much the same thing. From other
discussions, I gather that "multiple actions per controller" is
considered a Good Thing on platforms like Ruby on Rails.

>From a technical perspective, the two true pain points are "input" and
"prepare". We need a natural way to obtain an input form that can also
call a method that loads any rich controls the form may use. The
standard S2 idiom for that is Preparable and "action!input". It's an
elegant idiom, but the mechanism paves the way for other forms like
"action!create", "action!read", "action!update", and "action!delete".

It might be interesting to discuss some elegant, one-method purist
alternatives that address input preparation without using method
invocation.

-T.

On Nov 6, 2007 8:10 PM, Gary Affonso <[EMAIL PROTECTED]> wrote:
> Ted Husted wrote:
> > Of course, if you use one-action-method per Action-class, then all the
> > annotations work just fine.
>
> +1 on one-action-method per Action class.
>
> My personal opinion (after nearly 5 years of heavy WebWork/s2 use) is
> that this is the best-practice and that multiple action methods per
> Action class should be a rarity.
>
> For some reason folks new to s2 seem to get it backwards and want to
> stuff a bunch of Action methods into a single Action class.
>
> There's a lot of downsides to that (as this post and another recent post
> both illustrate) and there are few upsides.  And the upsides you might
> think are upsides (like code sharing between Action methods) are often
> not the upsides you think they are.  If you're sharing lots of code
> between Action methods, it's my experience that code belongs in other
> classes or even in other tiers.
>
> My first WebWork app had a small number of Actions and lots of Action
> methods.  I came to regret it.
>
> My latest s2 apps have one-action-method per Action class.  Religiously,
> no matter how silly it might seem to write a do-nearly-nothing Action.
> I'm much, much happier this way and the app is way more self-documenting.
>
> Just my $.02.
>
> - Gary

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to