Friday, May 13, 2016

Web Architecture - Explained

What is 3-tier Architecture?


to understand this let us take the example of the shopping cart system where user can do all the shopping related task online. For for understanding this we will focus only on the item selection part of this online system, where user can select the item and add it to the cart. In 3 -tier architecture we have the following 3 layers which are:

Presentation layer: 
This layer will notify the business layer with the action user have taken in the front end which may be like clicking the ADD TO CART button in the page. Here when the user click the button which is for eg. implementing the AJAX will send information to the business layer and when the business layer provides the success response then the user will see the visual effects like Item being added to the cart or the cart item number increase visually. In spring the use of @Controller Annotation is used in this layer.

Business Layer: 
In this layer after getting the request from the presentation layer the this layer will create the Customer Order Object or the Model using the different business criteria. such as:
- is the item available in the inventory.
- calculate the price of the item or calculate the total price of the items
- calculate the shipping cost
- finally store this information in the session
In spring the use of @Service Annotation is used in this layer. The core domain and domain logic is addressed in this layer.


Data Access Layer:
This layer will now finally persist the Customer order in the physical data store like Oracle, MySQL etc. In Spring ORM and Hibernate comes in this layer. In spring the use of @Repository Annotation is used in this layer.

For the extra security we can also add the extra layer i.e. Security layer between the Presentation and Business Layer. Spring Security can be used as the security layer.


Monolith N-tier

The monolithic application consists of a single application layer that supports the user interface, the business rules, and the manipulation of the data all in one. It is very simple to develop but not typical architecture for the software engineering. Only applicable if the application is small or does not need future expansion.


No comments:

Post a Comment