difference between tier and layer architecture in ASP.NET


Before understand difference between n/3 tier architecture in asp.net or n/3 layer architecture we have to understand first of all what is Tier and What is layer?

Layer and Tier


The layers reside on the same machine where the tiers can reside on different machines i.e. an individual running server is one tier, which may mean different assemblies such as DLL, EXE, etc. on the same server or multiple servers, that means we can say that Layer is logical separation of code and Tier is physical separation of code i.e. Tiers are the physical deployment of layers. In other words we can say that Tier Architecture is a physical structuring system where as Layer Architecture is a logical structuring system.

Layer is a good way to achieve tier architecture. Layer and tier may or may not exactly match each other. Each layer may run in an individual tier. However, multiple layers may also be able to run in one tier.

Layer communicates with each other either by Value or by Reference while tier communicate by Value only – as serialized objects.

The 3/n-layer/Tier application has mainly three layers.
1. Presentation Layer
2. Business Logic Layer
3. Data Access Layer

Presentation Layer


The Presentation Layer is basically responsible for displaying the user interface page like ASP.NET, ASPX pages, user controls, html page to the end user, So it is very important layer for getting user data and pass to Business Logic Layer for further operation, and when data is received in Value Object then it’s responsible to represent value object in the appropriate form which user can understand easily.

Business Logic Layer


The Business Logic Layer (BLL) is basically contains all the calculations and business rule that are required in the development of the application. C# business logic layer act as a bridge between Presentation Layer and data Access layer. In this layer the all the functionality that get data from the Presentation Layer and send that data to database through Data Access Layer.

Data Access Layer


The Data Access Layer (DAL) is basically gets the data from the business layer and sends it to the database or vice versa. DAL is responsible for accessing data and forwarding it to BLL. In an ASP.NET n­Tier architecture, web pages do not make direct access to the database

prestation-layer-bussiness-layer-data-access-layer-architecture
3/n- Layer/Tier Architecture
 Advantage:-

1. Presentation layer can only access the public components in application layer, but not in data layer where as Application layer can only access the public components in data layer, but not in presentation layer. This process can minimize the dependencies of layers on each other and provide finer security control to the whole system.

2. Since each layer are independent so it is easy to change one database storage too another database storage like from MS SQL Server to oracle.

3. Suppose we need to change some change in business access layer than no need to change in data access layer i.e. if we change in business layer than data layer no effect.

e.g. recently The Indian Govt. change our Tax system, than Indian Govt. only need to update business logic system without changing or affecting in the other system.

Disadvantages:-

1. If we use n- tier application in our project, we know it has great advantage but still it has some disadvantage, the performance of the entire system may be slow if the hardware and network, computers and processes aren’t good enough for the system.

2. Cost of the entire System may be hike because more hardware, network system involved..

3. Maintenance and deployment of the system become difficult because more hardware and better network bandwidth are needed for deployment and maintenance.

Note:-
All above layers are able to run in three separate computers. Practically, these three layers can also be deployed in one computer ﴾3‐Tier architecture, but deployed as 1‐Tier﴿.

3-Layer:-

In 3 layer architecture , the Database Access Layer (DAL), Business Logic Layer (BLL) and User Interface Layer (UIL) resides as 3 different project and the output of these 3 projects must be together in the same server or on same machine in order for the system to run.
In 3 layer architecture DAL, BLL and UIL can work on same machine.

3-Tier:-

In three tier architecture the Database Access Layer (DAL), Business Logic Layer (BLL) and User Interface Layer (UIL) reside as 3 different projects. But each of the projects can be deployed at the different server or at the different machines and distributed functionality is explored.

In three tier architecture in asp net c# a client in on one machine, the application Server is hosted in another machine and the database server resides in another machine i.e. Three-tier is a client–server architecture in which the User Interface, Business Logic , Data Storage and Data Access are developed and maintained as independent modules on separate platforms.

N-Tier:-

We hear a lot of time about c# n tier architecture even some of us read or use N‐Tier architecture for many time but still misunderstand its concepts of it. In this part we tries to clarify many basic concepts in N‐Tier architecture and we will also provide some industry based examples in the next parts.

N-tier architecture is probably one of the most used architecture models in the usually use in industry software architecture model, N-tier supports client/server applications by solving many points like scalability, security, extensible, secure and maintainable, over time, functionality and many more which helps the developers with different roles to better do their job without interfering with each other.

Visual studio have no pre‐defined tools or process that tell how to implement or solve the N-Tier architecture so it is very necessary to understand full concept of N-Tier before implementation.

N‐tier data applications are data applications that are separated into multiple tiers. Also called distributed applications and multitier applications. N‐tier application includes a presentation tier, a middle tier, and a data tier.

During Development of the n tier application or n layer application we need to keep in mind some points which are given below.

1.   All Application tier or layer must be independent to each other.

2.   Each component and module must be responsible for specific feature or functionality.

3.   Each functionality must be define once in the application

4.   Your application must be developed as like whenever you need to add new layer/tier or change technology you can implement easily.

5.   Most important point to remember must set some coding standard, Each developer has own standard coding style.

0 comments:

Post a Comment