Business Layer

Business layer consist of Business Logic i.e all data processing calculation done here ,this layer is abstract for the client. It process the data coming from view and send it back. There are several design pattern are as under

  • Business Delegate
  • Service Locator
  • Session Fašade
  • Transfer Object
  • Transfer Object Assembler
  • Composite Entity
  • Value List Handler

Business Delegate

View delegates logic processing responsibility to business delegate or business object. You want to minimize coupling between clients and the business services, thus hiding the underlying implementation details of the service .
Business delegate design pattern helps developer to separate the presentation layer (view) from the actual logic (business logic) part because need arise whenever view need to change ,it will not effect on the implementation of business logic and whenever business logic need to change ,than view implementation will not effect.

Uses
  • Minimize coupling between clients and the business services.
  • Avoid unnecessary invocation of remote services.
  • Translate network exceptions into application or user exceptions.
Advantages
  • Reduces coupling, improves maintainability.
  • Improves availability, performance.
  • Increase maintainability and reusability.

Service Locator

The service locator design pattern is used when you to implement and encapsulate service and component lookup. Service Locator pattern makes use of caching technique. For the first time a service is required, Service Locator looks up in JNDI and caches the service object. A Service Locator hides the implementation details of the lookup mechanism and encapsulates related dependencies.

Uses
  • Use to centralize and reuse the implementation of lookup mechanisms for J2EE application clients.
  • Use to encapsulate vendor dependencies for registry implementations, and hide the dependency and complexity from the clients.
  • Use to avoid performance overhead related to initial context creation and service lookups.
Advantages
  • Hides complexity.
  • Improves network performance.
  • Improves client performance by caching.

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 layer to clients.
The Session Facade design pattern abstracts the underlying business object interactions and provides a service layer that exposes only the required interfaces. Thus, it hides from the client's view the complex interactions between the participants. The Session Facade manages the interactions between the business data and business service objects that participate in the workflow, and it encapsulates the business logic associated with the requirements.

Uses
  • Provide a simpler interface to the clients by hiding all the complex interactions between business components.
  • Reduce the number of business objects that are exposed to the client across the service layer over the network.
Advantages
  • Hides complexity
  • Provides uniform service access to clients.
  • Improves network performance.

Transfer Object

Transfer Object design pattern is use to encapsulate the business data. A single method call is used to send and retrieve the Transfer Object. When the client requests the enterprise bean for the business data, the enterprise bean can construct the Transfer Object, populate it with its attribute values, and pass it by value to the client.
When an enterprise bean uses a Transfer Object, the client makes a single remote method invocation to the enterprise bean to request the Transfer Object instead of numerous remote method calls to get individual attribute values. The enterprise bean then constructs a new Transfer Object instance, copies values into the object and returns it to the client. The client receives the Transfer Object and can then invoke accessor (or getter) methods on the Transfer Object to get the individual attribute values from the Transfer Object.

Uses
  • use to reduce remote requests across the network.
  • clients to access components in other layers to retrieve and update data.
Advantages
  • Reduces network traffic.
  • Transfers more data in fewer remote calls.
  • Reduces code duplication.

Transfer Object Assembler

The Transfer Object Assembler combines multiple Transfer Objects from various business components and services, and returns it to the client.

Uses
  • Minimize the network calls to remote objects when building a data representation of the business layer object model.
  • Use to create a complex model to hand over to the client for presentation purposes.
  • Use when clients to be independent of the complexity of model implementation, and you want to reduce coupling between the client and the business components.
Advantages
  • Separates business logic, simplifies client logic.
  • Reduces coupling between clients and the application model.
  • Improves network performance.

Composite Entity

Use Composite Entity to model, represent, and manage a set of interrelated persistent objects rather than representing them as individual fine-grained entity beans. Composite Entity use to implement persistent Business Objects using local entity beans and POJOs.
A persistent object is an object that is stored in some type of data store. Multiple clients usually share persistent objects.
A coarse-grained object is self-sufficient. It has its own life cycle and manages its relationships to other objects.

Uses
  • Use to avoid the drawbacks of remote entity beans, such as network overhead and remote inter-entity bean relationships.
  • Use to implement parent-child relationships efficiently when implementing Business Objects as entity beans.
  • Use to encapsulate and aggregate existing POJO Business Objects with entity beans.
  • Use to encapsulate the physical database design from the clients.
Advantages
  • Increase maintainability.
  • Reduces database schema dependency.
  • Improves network performance.

Value List Handler

Value list handler is use to cache the results and allow client to search, traverse and select items from the results. The ValueListHandler directly accesses a DAO [Data Access Object] that can execute the required query. The ValueListHandler stores the results obtained from the DAO as a collection of Transfer Objects. The client requests the ValueListHandler to provide the query results as needed.

Uses
  • Use to provide the clients with an efficient search and iterate mechanism over a large results set.
  • Use to maintain the search results on the server side.
  • Use to implement a read-only use-case that does not require a transaction.
Advantages
  • Caches search results.
  • Provides flexible search.
  • Improves network performance.
  • Creating a large list of Transfer Objects can be expensive.