You are building the server side of an application and you are finalizing the interfaces that you'll provide to the client side. But you have not yet decided whether the business rules will be fully implemented as stored procedures or in the java code. Which design pattern you should use to mitigate this concern? Option 1 Business Delegate Option 2 Facade
I picked Facade and it was wrong why ? Can't you accomplish the same thing using facade ?
Hi Ersin, You can do that using facade. But when you look at J2EE design patterns architecture, it is recommended to use a Business Delegate to access SERVER SIDE apps. This will help clean separation of V from M and C of the MVC pattern. Facade and Business delegate have almost the same functionality but Business Delegate is the J2EE pattern to go with. Correct me if i am wrong. Ram Dhan Yadav K
Ram Dhan Yadav (SCJP, SCWCD, SCJA-I, IBM EC(483))
"We are what we repeatedly do. Excellence, then, is not an act, but a habit."
Joined: Feb 22, 2001
Thanks for the reply. I believe that you are right.
use a Business Delegate to reduce coupling between presentation-tier clients and business services. The Business Delegate hides the underlying implementation details of the business service , such as lookup and access details of the EJB architecture. Related Patterns: Service Locator: This pattern may be used to create Business Delegate's Service Locator, hiding the details of implementation Proxy: A Business Delegate may act as a proxy , providing a stand in for objects in the business tier Adapter: Business Delegate may use the Adapter Pattern to provide coupling for disparate systems Broker: A Business Delegate performs the role of a broker to decouple the business tier objects from the clients in the other tiers
I think I fooled myself by thinking that I could do that using Facade but it is not the standard way of doing it ! Another tricky one Session Facade
use a session bean as a facade to encapsulate the complexity of interactions between the business objects participating in a workflow . The session facade manages the business objects , and provides a uniform coarse-grained service access layers to clients Related Patterns: Facade : Session Facade is based on it. DAO : One of the strategies for the business component in the Session Facade pattern is to use the DAO. Service Locator: Session Facade can use this pattern to reduce the code complexity and exploit the benefits offered by the Service Locator. Business Delegate: Session Facade is used by Business Delegate when the client requests access to business services .The Business Delegate proxies or adapts the client request to a session Facade that provides the requested service. Broker: Session Facade performs the role odf a broker to decouple the entity beans from their clients.
Quotes are from the great bookcalled Core J2EE Patterns . I just bought it and started to read it few hours ago. [ January 08, 2002: Message edited by: ersin eser ]
Speaking of books on Patterns, are these patterns (mentioned for SCWCD exam) in the GOF book also. Not sure if I want to spend $$$ on two books... GOF and Core J2EE patterns Thanks for any advice. - satya
Readers at Amazon reported that the content of the J2EE Pattern book is not very different from their J2EE pattern section online (will check up link later in office). I am thinking of buying the Sun J2EE pattern book. Ersin: Please. Can you give any advice?
Joined: Feb 22, 2001
If you want to save some money just go ahead and do the online tutorials first that should be enough for the test . I am not a good online reader: if the content is longer than two letter size pages then I just print it out.