Because each layer can only change a small number
Code It can be put on different physical servers, so the structure is flexible and the performance is better. In addition, other layers in each layer are completely invisible. Therefore, you no longer need to re-compile or change all layers to modify or update a layer. This is a very powerful function. For example, if you separate the data access code from the business logic layer, after the database server changes, you only need to change the data access code because the business logic layer remains unchanged, therefore, you do not need to change or recompile the business logic layer. One n-layer application
Program There are usually three layers: presentation layer, business layer, and data layer. Next let's take a look at what each layer does. The presentation layer is used to display user interfaces, and to "Drive" These interfaces with classes and objects at the business layer. In ASP. NET, this layer includes aspx pages, user control, server control, and some security-related classes and objects. The business layer is used to access the data layer, fetch, modify, and delete data from the data layer, and return the results to the presentation layer. In ASP. net. This layer includes using sqlclient or oledb to retrieve, update, and delete data from SQL Server or access database, and placing the obtained data in datareader or dataset and returning it to the presentation layer. The returned data may only have one integer number, for example, the number of row records in a table. However, the data must be calculated at the data layer. Bll and Dal are usually divided into two child layers: business logic layer (BLL) and data access layer (DAL ). The business logic layer is above the data access layer, that is, BLL calls the Dal class and object. Dal accesses the data and transfers it to BLL. In ASP. NET, this layer can use sqlclient or oledb to retrieve data from SQL Server or access database, and send the data to bll in the form of dataset or datareader. BLL processes the data to the presentation layer. Sometimes, for example, BLL is a transparent layer when dataset or datareader is directly sent to the presentation layer. The data layer is a database or data source. In. net, it is usually an SQL Server or access database, but not limited to these two forms. It may also be Oracle, MySQL, or XML. The logical layer vs (distributed) physical layer is easy to confuse these two concepts. We say that the logic layer divides layers by class sets, and these layers are all on the same server. (Distributed) the physical layer refers to the collection of classes on different servers, and additional code is used to process inter-layer communication, such as remoting and Web services. It is very important to decide how to divide your layer (whether it is physical or not physical. When dividing, consider the following factors: 1. Note that if you divide your applications into physical layers, the speed of communication between different servers may slow down due to network latency. Therefore, if you decide to use the physical layer, ensure that the performance improvement is greater than the performance reduction. 2. design your applications based on the N-layer architecture. 3. The cost of deploying and maintaining physically distributed applications is high. You need more than one server first. You also need network hardware to connect to these servers. In this case, deploying applications becomes more complex! Therefore, before doing so, determine whether it is worthwhile. In addition, pay attention to the usage of each layer of your application. You may need to place the layer on another server because multiple services run require a certain layer. For example, you may customize different performance layers for different users and place the business logic layer elsewhere. You may also access the same database because of other applications, the SQL Server service is put elsewhere.
Today, I wrote the source code for several websites, but some of them cannot run. It seems that the three-tier architecture is used and I don't know what it means ~ So I picked this article online.Article.. You may understand later
Because each layer can be put on different physical servers after only a small amount of code is changed, the structure is flexible and the performance is better. In addition, other layers in each layer are completely invisible. Therefore, you no longer need to re-compile or change all layers to modify or update a layer. This is a very powerful function. For example, if you separate the data access code from the business logic layer, after the database server changes, you only need to change the data access code because the business logic layer remains unchanged, therefore, you do not need to change or recompile the business logic layer.
An N-tier application usually has three layers: presentation layer, business layer, and data layer. Next let's take a look at what each layer does.
Presentation Layer)
The presentation layer is used to display user interfaces and to "Drive" These interfaces using classes and objects in the business layer.
In ASP. NET, this layer includes aspx pages, user control, server control, and some security-related classes and objects.
Business tier)
The business layer is used to access the data layer, fetch, modify, and delete data from the data layer, and return the results to the presentation layer.
In ASP. net. This layer includes using sqlclient or oledb to retrieve, update, and delete data from SQL Server or access database, and placing the obtained data in datareader or dataset and returning it to the presentation layer. The returned data may only have one integer number, for example, the number of row records in a table. However, the data must be calculated at the data layer.
BLL and Dal
generally, this layer is divided into two child layers: business logic layer (BLL) and data access layer (DAL ). The business logic layer is above the data access layer, that is, BLL calls the Dal class and object. Dal accesses the data and transfers it to BLL.
in ASP. in. net, this layer can use sqlclient or oledb to retrieve data from SQL Server or access database, and send the data to bll in the form of dataset or datareader. BLL processes the data to the presentation layer. Sometimes, for example, BLL is a transparent layer when dataset or datareader is directly sent to the presentation layer.
data tier
the data layer is a database or data source. In. net, it is usually an SQL Server or access database, but not limited to these two forms. It may also be Oracle, MySQL, or XML.
logical layer vs (distributed) physical layer
it is easy for people to confuse these two concepts. We say that the logic layer divides layers by class sets, and these layers are all on the same server. (Distributed) the physical layer refers to the collection of classes on different servers, and additional code is used to process inter-layer communication, such as remoting and Web services.
it is very important to decide how to divide your layers (physical or physical. When dividing, consider the following factors:
1. Note that if you divide your applications into physical layers, the speed of your applications will slow down due to the delay of communication between different servers on the network. Therefore, if you decide to use the physical layer, ensure that the performance improvement is greater than the performance reduction.
2. design your application based on the N-layer architecture.
3. The cost of deploying and maintaining physical distributed applications is high. You need more than one server first. You also need network hardware to connect to these servers. In this case, deploying applications becomes more complex! Therefore, before doing so, determine whether it is worthwhile.
note how to use each layer of your application. You may need to place the layer on another server because multiple services run require a certain layer. For example, you may customize different performance layers for different users and place the business logic layer elsewhere. You may also access the same database because of other applications, the SQL Server service is put elsewhere.