Look at the appearance and B layer
During data center reconstruction, the appearance is used. However, when the appearance is used, the business logic layer does not reflect its own functions, but instead
The business logic is basically transferred to the appearance layer, and we didn't think too much about it, so we finally finished the restructuring. However, when we cooperated, we reached an agreement
The appearance is the function of appearance, and the B layer is the function of business logic. Before that, we need to clarify the following two concepts:
1. What is the appearance?
We have learned the appearance mode in the design mode and know that the appearance provides a consistent interface for a group of interfaces in the subsystem. Many people
See the following picture
This figure vividly shows the effect of the appearance and provides a clear interface for the U layer, which is very convenient.
However, we will unconsciously misinterpret the role of the appearance in the specific data center. Let's look at it first.
2. Business logic layer (layer B)
What is business logic? Business Logic is the processing of data business logic. At first glance, it is the business logic, but what is it?
The business logic includes the following aspects:
1. Domain entity: objects in the business, including attributes and behaviors;
2. Business Rules: specify the conditions to be met to complete an action;
3. Data Integrity: some essential data;
4. workflow: interaction between entities;
It seems like a vague concept. I don't quite understand it. For example, just log on to the IDC.
1. Domain entity: user name and password
2. Business Rules: click Login to log on to the system. However, you must enter the correct user name and password before logging on to the system.
3. Data integrity: the user must have the username and password for Logon. If not, the user cannot log on to the system.
4. workflow: enter the correct account password-> click logon-> prompt success-> enter the system
This is the business logic layer. What is the business logic layer we write? It only returns a value, which is totally overhead by us.
Iii. Transfer
During the reconstruction, we seem to have played the role of the business logic layer, data integrity, and business rules fully reflected.
The lack of workflow, now aware of the existence of this problem, the next step is to solve this problem, transfer, let them play their own
Responsibilities
Appearance: Aggregates some classes on the B layer to provide a clear interface for the U layer, so that the U layer and B layer can be better decoupled.
Layer B: Bring back the business logic that should belong to layer B from the appearance, and give full play to the role of layer B
We look forward to the next article on how to solve the problem of business logic transfer.
Conclusion: There will be many different ideas in teamwork. When we are expressing our opinions or listening to others' opinions, it is
A good learning process, through the exchange and collision of ideas, provides a deeper understanding of knowledge.