All,
 
Let me throw out an idea for your review and discussion.
 
We have found that our EJB based designs would benefit from having an abstract Home interface to use to invoke Home interface methods. This abstract Home would act as a factory, serving as the central interface for all Home method invocations, but internally delegating the calls to the appropriate EJB Home object. EJB Clients would use this abstract Home directly to get/manipulate EJB Objects rather than the specific Homes. Such an abstract Home would use Reflection to dynamically satisfy client requests.
 
We see a few major advantages to this approach. First, as detailed above, clients can deal with a more abstract class rather than a specific Home. This allows us to build more flexible clients, clients that could deal (create/find/remove) with more than one EJB Type in a uniform manner. Second, it simplifies your code. For example, you have reduced the number of locations where you would have redundant exception handling.  Perhaps the Home Interfaces could be cached here as well.  Although I dont know if there might be other implications with this idea.
 
Of course, were aware of a few disadvantages as well. Leading the pack would be potential performance degradation. Since the most flexible solution would require the use of Reflection, and Reflection can impose major performance penalties on your system, this Home might degrade the performance of your systems Home interface methods significantly. Of course you could use some Reflection Caching (storing all Methods of an Interface) to reduce the number of times that you pay this penalty. Right behind performance problems in the negative category would be the loss of compile time checking. By using this abstract Home your code will no longer be able to benefit from Java's strong Type checking. Any potential developers errors in invoking a Home method would not be noticed till runtime.

These are a few of our thoughts on the matter. Has anybody else implemented something like this? What are/were the results? What other Pros/Cons does the group see with implementing such a Home?
 
Thanks,
 

</Mike Porter>
************************************************
Mike Porter
Director of Technology
eSage, llc
(206) 264-5541 (Voice & Fax)
[EMAIL PROTECTED]
www.esage.net
 
 
 

Reply via email to