This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I was just going through the design patterns.viz the "business delegate".according to what i understood about it is:
A business delegate hides the complexity of the remote services etc. from the controller.It interacts with the Service Locator for the Remote
Object,Which is a stub,and then calls the methods on this stub.I hope i got it right??
But somwhere i read that it acts as a stub,it implements the remote interface.What exactly is true regarding the business delegate??
The primary purpose of the pattern is to reduce the degree of coupling between one or more client objects and one or more objects that provide business functionality, i.e. business objects. The pattern can be implemented on the Presentation-tier or Business-tier.
Aside, "Business Delegate" is the name of a design pattern so both words in the name should be capitalized. Also, the word "I" is always capitalized, not only when it is the first word of a sentence. For example, "When I went to the store I purchased a container of milk."
I do not agree with your explanation.
1) Business delegate can only be placed on presentation tier. If we place this code on the business logic tier, than we can name it Facade, Gateway, Adapter and so on (depending on implementation details), but not Business Delegate.
2) The main purpose of this pattern is to decouple the client from stub implementation details and its underlying technology. In this case the client can get rid of handling EJB2.0-specific excpetions, RMI exceptions and so on.
I.e. instead of having the call:
Client -> Client stub (where client stub is tightly coupled to some tehcnology, e.g. EJB, RMI, SOAP, REST, JMX, CORBA, etc.)
... we would have
Client -> Business Delegate -> Client stub
... and the delegate will completely hide the stub from us.
Joined: Sep 27, 2011
A little correction to my previous post:
1) Business delegate can only be placed on presentation tierclient's side.
Joined: Apr 16, 2008
There can be client objects that reside on the Business tier. These would be business objects that request services from another business objects. The J2EE Business Delegate pattern applied here as well.
Aside, the term "client object" can refer to more than one concept. Here I'm not referring to "client side" or anything related to the "user" of an application.