J2EE DESIGN PATTERNS - Business Delegate

When the presentation-tier components access the business services implemented by the business-directly through the exposed API of the services. The clients are exposed to the complexity of dealing with distributed components. The client is tightly coupled to the EJB layer, creating dependencies between client and server that affect both development, run-time and project management concerns. Due to this

1. The presentation-tier components are vulnerable to changes in the implementation of the business services, when ever the implementation of the business services change, the exposed implementation code in the presentation tier must change too.

2. All the client side components have to be aware of the location details of the business services say that each components has to use the JNDI lookup service to locate the required remote interfaces.

3. There may be a detrimental impact on network performance because presentation-tier components that use the business service API make too many invocations over the network. This happens when presentation-tier components use the underlying API directly, with no client-side caching mechanism or aggregating service.

The solution is to create a layer of 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.

Business delegate handle all the code that access the business services in the selected vendor software. When the vendor or the vendor software changes only changes that need to be made is to the company’s allocation software are changes to Business delegate, to access the business services. The presentation layer need not to be modified.

The business delegate object abstracts the business services API and provides standard interface to al the client components. It hides the underlying implementation detail such as lookup mechanism and the API of the business services. This reduces the coupling between the clients and the business services.

Another benefit is that the delegate may cache results and references to remote business services. Caching can significantly improve performance, because it limits unnecessary and potentially costly round trips over the network.

The responsibilities of the components participating in this pattern are:

Client components : The client components which are jsp pages and servlets in the presentation tier, delegate the work of locating the business service providers and the work of invoking the business service API methods to the Business Delegate objects.

Business Delegate : The business Delegate acts as a representative of the clinet components. It knows how to look up and access the business services. It invokes the appropriate business services method in the required order . If the API of the business service component changes, only Business Delegate needs to be modified without affecting the client components
.

Business Service : A business service component implements the actual business logic. Some examples of the business service components are stateless session EJB and entity EJB a CORBA object or an RPC server.




J2EE Patterns
Intercepting Filter
Front Controller
Composite View
View Helper
Dispatcher View
Service to Worker
Business Delegate
Session Facade
Service Locator
Transfer Object Assembler
Value List Handler
Composite Entity
Transfer Object
Service Activator
Data Access Object
Use of this website constitutes acceptance of the AllAppLabs.com Terms and Conditions