The advantages of object-relational mapping ORM are: 1. Improves development efficiency and reduces development costs; 2. Only object-oriented programming is required, and no code is required to be written for the database; 3. The details of data access are hidden, thus It realizes the decoupling of data model and database, and shields the differences in operation of different databases.
The advantages of object-relational mapping ORM are:
Object-oriented is based on the basic principles of software engineering (such as coupling, aggregation, encapsulation), while the relational database is developed from mathematical theory. There are significant differences between the two sets of theories. In order to solve this mismatch phenomenon, object-relational mapping technology came into being.
Object Relational Mapping
(Object Relational Mapping, ORM) is a programming technology used to convert data between different types of systems in object-oriented programming languages.
Specifically, the mapping between objects in object-oriented language programs and data in relational databases is achieved by using metadata that describes the mapping between objects and databases. In effect, it actually creates a "virtual object database" that can be used in programming languages. It generally exists in the form of middleware.
ORM has the following advantages:
1. Improves development efficiency and reduces development costs. Since ORM can automatically map properties and fields between Entity objects and Tables in the database, we may not actually need a dedicated and huge data access layer.
2. Only object-oriented programming is required, and there is no need to write code for the database.
Operations on the database are converted into operations on classes.
No need to write SQL statements for various databases.
3. The details of data access are hidden, thereby realizing the decoupling of the data model and the database, and shielding the differences in operations of different databases.
No need to pay attention to what database is used.
You can easily change the database through simple configuration without modifying the code.
Related learning recommendations: mysql video tutorial
The above is the detailed content of What are the advantages of object relational mapping ORM?. For more information, please follow other related articles on the PHP Chinese website!