Tiers

A tier is a physical unit, and it is related to hardware and software components. It is the infrastructure in which the layer components are deployed and executed. Examples of tiers are web browsers, application servers, and database servers. A typical n-tier application is defined with the following tiers:

Tier Infrastructure
Client  Web browsers, a mobile device
Presentation  Web server (container), HTTP protocol
Business Application server (such as Java EE server)
Data/Integration Database servers, messaging service, web services

 

Let's look at the following diagram:

Here, it is very important to note the difference between the client tier and the presentation tier. The client tier is where a client application is executed (through platforms such as a browser or a mobile application). Generally, the client tier is the client machine or device, and the presentation tier is represented by the web server. The presentation tier receives a data request from the client tier, prepares the data (with some format defined previously, if necessary), and sends it to the business tier. This is the classic mechanism of how data is processed in a JEE scenario. We can identify some technologies in the presentation tier, such as Servlets, JSP, JSF, WebSockets, JAX‐RS and JAX‐WS, Java API for JSON processing, JSON-B, CDI, and bean validation.

Let's look at the following diagram:

As previously discussed, it is in the business tier that all business logic is executed. The presentation tier is the client of the business tier because it requires operations of the business tier and receives the result that comes from the business tier. At this point, we can see an additional responsibility for the presentation tier, which is to locate the service and make the request. It would be interesting if we had a mechanism that delegated the request to the real service. This is the role of the Business Delegate pattern, which prevents details of the business tier services from being exposed to the presentation tier. The coupling between the presentation and business tiers is reduced, and therefore modifications in the business tier have a minimal impact in the presentation tier. 

The Business Delegate pattern acts as an input door for the client. It is responsible for receiving the request, identifying or locating the real business service, and calling the service sending the request. After that, the delegate receives the service response and then sends the response back to the client.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.249.210