Dan,

It really depends on how the interface of your application is designed.  If
you have a complex UI screen where Dogs are listed and someone can edit a
dog in the same screen, it actually might be better to have everything in a
single action bean.  Whereas, if you have a discrete list screen and a
discrete add/view/edit dog screen... then it might make sense to have two
smaller action beans.

I have action beans that employ both styles.  For example, I have a single
DogActionBean which serves as a REST API for serving individual Dog
requests... as well as listing Dogs.  In this case, I put it all in one
bean.  Depending on what a REST API handler does, there are bound to be
other unused variables in the REST service class (in this case an
ActionBean) that go unused.

I wouldn't consider it a code smell.  IMHO, I consider it more of a smell
to forcibly create classes with single handlers/services because I was
trying to make sure every member variable was in use on every method call.
 Everything is a balance.  You don't want massively huge spaghetti
ActionBeans.  You also don't want 500 ActionBeans each with one handler.

I've written several applications with Stripes in the mix.  I have
personally found it a best practice is to create an ActionBean for each
approximate "screen".  In many cases, one screen can represent the CRUD of
a domain object -- that's fine.  In other cases, a "screen/view" can be
fairly complicated and require a more complex (single) ActionBean to handle
it.

Good luck,

-- Rick


On Fri, Jan 24, 2014 at 6:52 PM, Dan Kaplan <d...@mirthcorp.com> wrote:

> I like stripes' simplicity, but I often run into a maintenance problem I
> don't know how to solve:
>
> I have a handler in an action bean that needs a field that none of the
> other action beans need.  Worst case scenario, one handler uses half the
> fields and another handler uses the other half.  Here's an example:
>
> You have a DogActionBean.  It has a handlers for listDogs and viewOneDog.
>  listDogs shows you the list of created dogs.  viewOneDog lets you see the
> details of one of those dogs.  viewOneDog needs to know which dog its
> viewing to populate the jsp so it has a private Dog dog field.  This is
> completely unused in listDogs.  This feels like a code smell.  What's the
> solution to this?
>
> I'm playing the devils advocate.  I think the solution is to have finer
> grained action beans.  There should be a ViewOneDogActionBean and a
> ListDogsActionBean.  At least that's what I'd assume. If I'm right, I'd
> think having multiple event handlers in one action bean would be the
> exception, not the norm.
>
> --
> Thanks,
> Dan
>
> CONFIDENTIALITY NOTICE: The information contained in this electronic
> transmission may be confidential. If you are not an intended recipient, be
> aware that any disclosure, copying, distribution or use of the information
> contained in this transmission is prohibited and may be unlawful. If you
> have received this transmission in error, please notify us by email reply
> and then erase it from your computer system.
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to