[Architecture design]: data access layer (1)

Source: Internet
Author: User
Tags how to use sql

 

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 ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.