Hi Hari, I also have the same question and i have posted this question to the local java users group mailing list. Here is the question that i have posted. Can anyone clarify the difference between the Business Delegate and the session facade pattern. Both of them seems to be to be quite similar to eachother. The objective of both the patterns seems to be the same - To prevent the direct interaction of the client with the business services and reduce the coupling between the services and clients so that the client is not vulnerable to changes in the business services. - Another objective is to prevent multiple fine grained calls to the business services as multiple remote calls to the services increases the network traffic and decreases the performance. and the structure to both the patterns is Client <---> Session Facade <---> Business Objects Client <---> Business Delegate <---> Business Objects
The differences that i came with are ( i am not sure if they are right ) - A Session Facade is implemented as a session bean where as a Business delegate might not be a session bean. - A Business delegate can be used as a proxy to the session facade.
I will post the summary of the responses that i get. Ashish.
The purpose of a business delegate is to hide the EJB stuff from the client (app, JSP/Servlet). It does so by providing a simple Java interface to the client. Internally, the business delegate, wel... delegates the task to where it should go. This way, a client programmer can just think about the backend functionality as a Java class. A session facade, however, is a component (normally a stateless session bean) that aggregates the functionality (coarse-grained) that otherwise would be aggregated in functionality on the client side. So, instead of having the client make several costly calls to different server components, the client makes one call the the session facade, who makes in his turn the different calls to the server components (this isn't so costly as the facade is on the server side itself!) Hope this clears things up. regards, G�nther. http://www.javacoding.net
Simply put, a Session Facade can be used to do Business Delegate. You can read the defination from Sun for these two patterns, http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAGlance.html, The Session Fa�ade is used by the Business Delegate when the client requests access to business services. The Business Delegate proxies or adapts the client request to a Session Fa�ade that provides the requested service.