Preface:
Generally speaking, application architecture
What is most likely to be Lenovo is the "three-tier architecture 」
However, the application architecture I want to discuss
Abstract Logic is the layer-3 architecture.
Application Architecture planned for Software Design
For more information, see ". NET application architecture: designing applications and services" in the Microsoft File 」
This article focuses on "data access layer 」
Introduction:
All programs are inseparable from data access.
The data access layer is defined to separate data access from application logic.
Motivation:
Sometimes you need to change the database when developing applications,
For example, change the database from SQL to Oracle.
This problem occurs.
The common solution is to change the program code and SQL statements that communicate with the SQL database to Oracle.
Even more advanced, the SQL syntax will be made into a configuration file and loaded when executed.
This method can solve the problem.
However, if
What if I want to change the SQL database to a text file or an object-oriented database today?
Concept:
The data access interface defines the data access interface of logical object B.
Logical object a uses the data access interface to access logical object B.
Implements the data access interface and performs cutting with applications.
The advantage is that the application is separated from the data access layer.
The data to be accessed is determined by the object that implements the data access interface.
For SQL data access objects, you only need to pay attention to how to use SQL to implement data access interfaces.
To change the SQL database to an object-oriented database, you only need to implement an object-oriented database.
Implementation:
The "data access layer" is implemented
It consists of two parts:
1. Data access interface cutting: cut according to project considerations.
2. Data Access Object generation: see creational patterns or provider pattern.
Conclusion:
In fact, the architecture focuses on concepts.
It's just a skill to understand how to implement things ~