Core J2EE Patterns: Business Delegate Pattern
- Business Delegate
- Forces
- Solution
- Consequences
- Sample Code
- Related Patterns
Business Delegate
Problem
You want to hide clients from the complexity of remote communication with business service components.
When clients access remote business service components directly, the following problems can occur.
Clients interact directly with the business service interface. This means that when the business service code changes, the client code might need to be changed, as well. This increases the amount of maintenance you need to do and decreases the system’s flexibility.
Another problem relates to network performance. When clients interact directly with the business services API, a single action in the client can require many complex fine-grained interactions with the business services. This leads to embedding business logic into the clients without any client-side caching or aggregation of services, thus reducing maintainability. Since this takes place over a network, it also decreases network performance.
A third problem is that interacting so closely with the business service API can mean the client code needs infrastructure code to interact with a remote distributed middle tier. This infrastructure code deals with naming services, such as JNDI, handling network failures, and retry logic.