Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Reuse - Base class for backing beans
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Flack  
View profile  
 More options Oct 16, 5:40 am
From: John Flack <JCFl...@excite.com>
Date: Thu, 15 Oct 2009 12:40:48 -0700 (PDT)
Local: Fri, Oct 16 2009 5:40 am
Subject: Reuse - Base class for backing beans
I found that there were some methods that I was writing again and
again in backing beans.  So I finally wrote my own backing bean base
class, and now all my backing beans subclass it.  Anybody else doing
this?  Good idea or bad?  Another approach is to write utility classes
like Steve Muench;s EL class, and call the utility methods where
needed.  Or some combination of the two.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Avrom Roy-Faderman  
View profile  
 More options Oct 16, 9:27 am
From: "Avrom Roy-Faderman" <av...@avromroyfaderman.com>
Date: Thu, 15 Oct 2009 16:27:58 -0700
Local: Fri, Oct 16 2009 9:27 am
Subject: Re: [ADF Enterprise Methodology Group] Reuse - Base class for backing beans
Well, I don't know about the EL class *specifically*--you're really not
"supposed" (by Faces standards) to be resolving EL in your beans (as
opposed to using injection). But the general idea of using
utility/singleton/pseudo-singleton classes (for things that can be
determined without injection, e.g., through BindingContext.getCurrent())
is preferable to doing this in a base class, because the coupling's
looser.

Here's what I mean: Suppose you have a base framework bean class,
myorg.framework.backing.BaseBackingBean. Then, you find a really cool bean
class published by a third party that you really want to use, but you need
to add in some functionality that is present in BaseBackingBean. You're in
trouble--you can't extend two classes at the same time, so you'll have to
duplicate code from one of them.

Now, by contrast, suppose you've just created a utility,
myorg.framework.util.BackingBeanUtils, and then you find that really cool
thrid-party bean. Now, it's no problem: You extend that third-party bean,
and delegate to methods from BackingBeanUtils. No code needs to be
duplicated.

A general principle: Subclassing to get functionality is more limiting
than using a utility to get functionality (which allows the base class to
vary), which itself is more limiting than using a composed object to get
functionality (which allows *both* the base class *and* the functionality
provider to vary). There can be factors that are more important than this
(e.g., if you want functionality from a class' protected methods, or if
the functionality is part of a framework that might call package-scoped
methods on it [as BC classes are], you'd better extend that class).

Best,
Avrom

> I found that there were some methods that I was writing again and
> again in backing beans.  So I finally wrote my own backing bean base
> class, and now all my backing beans subclass it.  Anybody else doing
> this?  Good idea or bad?  Another approach is to write utility classes
> like Steve Muench;s EL class, and call the utility methods where
> needed.  Or some combination of the two.

--
Avrom’s Java EE and Oracle ADF Blog
http://www.avromroyfaderman.com

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Koniotiakis  
View profile  
 More options Oct 16, 10:36 pm
From: Michael Koniotiakis <mko...@hotmail.com>
Date: Fri, 16 Oct 2009 05:36:31 -0700 (PDT)
Local: Fri, Oct 16 2009 10:36 pm
Subject: Re: Reuse - Base class for backing beans
We are also using base class for backing beans
We also use JSFUtils and ADFUtils.
In base backing bean we have methods for all actions and bindings to
template components.
(Like commit, rollback, insert, delete, exit, close, navigateTo,
openPopup etc)
We dont bind actions directly to bindings but allways to backing bean
that execute operations from bindings
For example for Commit button we have a method in Base class that
execute operation.
This helped us to add or change logic to all Commit buttons.
i.e. To add information on page that Commit was succesfull
      To check if there are changes on transaction and if not to show
message that 'No changes to save'

I think this saves us from a lot of repeating code.

On 16 Οκτ, 02:27, "Avrom Roy-Faderman" <av...@avromroyfaderman.com>
wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Muir  
View profile  
 More options Oct 21, 1:05 pm
From: Chris Muir <chriscm...@gmail.com>
Date: Tue, 20 Oct 2009 20:05:00 -0700 (PDT)
Subject: Re: Reuse - Base class for backing beans
Can't say we've created a backing bean super class either.  As Avrom
says most of the common code required in the BBs goes into a utility
class as a static function.

We do use JSFUtils and ADFUtils, though we're rewriting them from the
ground up.  This isn't an indirect comment on the quality of the
utility classes or there authors, but rather I'm not a big fan of
taking utility classes and leaving all the supplied methods in as
they're not tested in anyway by the programmers, the next programmer
can falsely assume they work correctly.  Instead as we need a function
in the utility class we add them, with the assumption they then get
tested by the programmer at hand.

Regards,

CM.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Stegeman  
View profile  
 More options Oct 21, 8:35 pm
From: John Stegeman <john.stege...@gmail.com>
Date: Wed, 21 Oct 2009 03:35:29 -0700 (PDT)
Local: Wed, Oct 21 2009 8:35 pm
Subject: Re: Reuse - Base class for backing beans
We *have* used backing bean super classes for specific use cases,
although not simply as a container for utility methods. The case I
have used them is when we have an application with a number of screens
that have similar/same functionality. An example of this is an
application where we esentially have a set of screens that all
function exactly the same way except that they each are used for
maintaining a different underlying database table. there was some
benefit in using a superclass for backing beans for those specific
screens - it enabled us to have the actual backing bean be simply a
constructor that set some private attributes (binding names and so
forth) that were defined for use in the parent class.

John

On Oct 21, 4:05 am, Chris Muir <chriscm...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jang Vijay Singh  
View profile  
 More options Oct 30, 10:16 pm
From: Jang Vijay Singh <jvs...@gmail.com>
Date: Fri, 30 Oct 2009 04:16:23 -0700 (PDT)
Local: Fri, Oct 30 2009 10:16 pm
Subject: Re: Reuse - Base class for backing beans
From this discussion, it hasn't emerged that it is in any way a bad
practice to have beans inherit methods/functionality from other base
classes.
So I guess it would hold true for event handler methods (like Value
Change Listeners, action listeners, validators)? I don't see any valid
reason it should be unless the base methods are closely tied to
specific binding names which may or may not exist in all pageDefs in
which that code gets used.

JV

On Oct 21, 10:35 am, John Stegeman <john.stege...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brenden Anstey  
View profile  
 More options Nov 6, 11:25 am
From: Brenden Anstey <brenden.ans...@delexian.com>
Date: Thu, 5 Nov 2009 16:25:06 -0800 (PST)
Local: Fri, Nov 6 2009 11:25 am
Subject: Re: Reuse - Base class for backing beans
Hi all,

I have been using the the base class approach on regular basis for
over year now and it definitely has its merits.

http://brendenanstey.blogspot.com/2007/03/how-to-reduce-coding-by-ext...

As John said the benefit of this comes in to play when you have really
simple stuff to do in the backing bean like chaining execution of
commit, execute or determining the outcome based on the value of
something.

If I remember correctly there was some talk (with Frank N) of defining
a base class somewhere in the UI project that would be extended
automatically when new managed/backing beans are created.

cheers,
Brenden


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florin Marcus  
View profile  
 More options Nov 11, 5:41 am
From: Florin Marcus <florin.mar...@gmail.com>
Date: Tue, 10 Nov 2009 10:41:15 -0800 (PST)
Local: Wed, Nov 11 2009 5:41 am
Subject: Re: Reuse - Base class for backing beans
Hi Brendan, interesting and useful posting!

Just one idea: how about the  'execute()' method from your example to
return the exception object instead of a boolean value.
It might prove useful when the business code is using a custom stack
of application exceptions.

Best,
Florin

On Nov 6, 2:25 am, Brenden Anstey <brenden.ans...@delexian.com>
wrote:.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brenden Anstey  
View profile  
 More options Nov 11, 1:20 pm
From: Brenden Anstey <brenden.ans...@delexian.com>
Date: Tue, 10 Nov 2009 18:20:00 -0800 (PST)
Subject: Re: Reuse - Base class for backing beans
Hi Florin,

absolutely, the JSFBean could go a lot further. Execute including
parameters and better return types would definitely enhance the
functionality.

cheers,
Brenden

On Nov 11, 2:41 am, Florin Marcus <florin.mar...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google