Object-oriented relational database design

zhaozj2021-02-08  411

Object-oriented relational database design (this article reprinted from Software Engineering Expert Network www.21cmm.com Theory is a talk. In fact, the former is the idea of ​​database users to define database patterns, the latter is the idea of ​​database management programs. Users can define any of the DBMS databases, ie network types, hierarchical, relational, object-oriented types, or even file system design, can follow object-oriented ideas. Object-oriented ideas or specifications can be used for system analysis, system design, programming, and can also be used in data structural design, database design. OOSE is from the top, and the object-oriented idea is implemented from beginning to end, it is a uniform body. Object-oriented database design is just a link of OOSE. Second, the importance of database design The general database design method has two, ie attribute leads, and physical leading. Attribute dominates from the attribute of the attribute database application, the function dependencies between the attributes are maintained when the attribute set (entity) is intended. Entity dominates first from finding meaningful entities applying meaningful databases, then defining an entity by defining properties. In general, the number of entities in the real world is 1/10 of attributes, and the entity dominant design method should be used. Object-oriented database design is from the object model, which belongs to entity dominant design. The general database application system follows the following related development steps: 1 Design application system structure; 2 Select the DBMS architecture that is easy to combine the application to DBMS, such as RDBMS; 3, select the appropriate DBMS (such as Oracle) according to the environment platform used by the application ) And development tools (such as PB); 4 Design databases, write SQL programs that define database modes; 5 Write to ensure that data correctly entered the database application; 6 Enter database data; 7 Run various database-related applications, To confirm and correct the contents of the database. For the above steps, there are a few things to explain: (1) This is not a waterfall model, and each step can have feedback. The above steps have not only feedback, but there is repeated, and there is parallel. For example, some library tables are in addition to the data entry, and other library tables are still modified. This is related to our incremental development method and is also related to object-oriented features. (2) The above order is not absolute, most occasions start from the third step. (3) For most database applications, the most important and difficulty in the above steps is not the application system design but the database design. Third, DBMS support and database design Many database application system developers do not pay attention to the database design reason: they are too superstitious DBMS, think that database design is not difficult after purchasing a powerful DBMS, is not important. Some domestic and foreign database textbooks are often promoted for DBMS development vendors, and rarely stand in the database user's perspective, introduce the database design method from the database application system. The results often make readers not introduced by the design idea of ​​database management procedures, or apply this DBMS for database design. In fact, DBMS just provides a stage for the users of the database, and whether the props on this stage and what to sing, depending on the arrangement of the user's drama script and director (developer). For example, the database management system used by the Highway Bureau is a two-dimensional table as a basic management unit, supports all relationship algebraic operations, supports the full-relational RDBMS of entity integrity and physical inter-physical reference integrity, and we are going on this stage. Use the above "props" to design an object-oriented relational database. 4. Application Object Model and RDBMS Model Mapping Database Design (Mode) Supports the object model of the application system, which is determined whether it is the basic starting point for object-oriented database systems. Since the application system is designed before, the database design is then the key to the application system object model to the database mode is the key to object-oriented database design. 1. Three-layer database mode Object-oriented Object-Metal Database Design Multi-references ANSL / SPARC About database mode 3-layer standard structure proposal. The internal mode closest to the physical database is described by the SQL provided by DBMS. The concept mode can be gathered by several internal modes, which is a collection of some tables that are specified by the database user. The general conceptual mode is the boundaries of the database physical model scope, which enables the physical meaning of the database, and the special operation of specific DBMS is hidden on external applications. The external mode is a database mode from a particular user application perspective, from different applications, from different applications, the same concept mode can give a variety of different external modes.

When the external application system is abstract in an object model, the abstract object model from each app can be mapped to the external model, and we may wish to call the external object model. However, the external model is only a subset of the concept model, so object-oriented database design core is the mapping of the system object model (may be called the conceptual object model) to the database concept model. 2. Object model The mapping rules for the database table are based on the two-dimensional table, so the object model is ultimately described by two-dimensional tables and intervals. In other words, the object model to the database concept model is the transformation process to the database table. The relevant transformation rules are simply summarized as follows: (1) An object class can map more than more than one library table, and a table can also correspond to multiple classes when there is a pair of relationships. (2) Mapping of relationships (one-to-one, one-to-many, multi-to-many and three relationships) may have a variety of situations, but generally mapped into a table, or the corresponding foreign key can be defined in the object class. For a mapping of conditional relationships, a table should have at least 3 properties. (3) Single inheritance of the generalization relationship can map the subclass, subclass separately, or if the parent class table is not defined, the subcaters have a parent class attribute; contrary, it is also possible to let the parent class may not be defined. The table has all subclass properties. (4) Map of multiple inheritance of superclass and subclasses, respectively, and maps a table for multiple multiple inheritance. (5) Redundancy control adjustment is performed to reach a reasonable relationship paradigm. 3. Database mode To apply the application, we choose object-oriented system design. Object-oriented database design is good, and fundamentally is to serve the application system. V. Object-oriented relational database design results In a sense, it is the object-oriented feature of the database design, which finally lays object-oriented object-oriented methods in the program development stage. Its effect is summarized as follows: 1. The database structure is clear and easy to implement OOP because the fully mapping of the application module object on the database object, the database logic model can naturally and directly simulate the real world entity relationship. The user's current physical world, system developer abstract system external function, corresponds to the internal database (data structure) of support system functions, so users, developers and database maintenance personnel can communicate with consistent languages. In particular, the program developers who do not understand the business, this kind of design method to encapsulate the object to the corresponding data object in the object unity, greatly alleviate the difficulty of the program, so that they only need to know the data and The required operation, and most of the application, you can inherit a variety of physical grade superclams that are abstracted by the designers. 2. The database object has an independence, so that in addition to the database table object and the application module object, we did not design multiple inheritance of the generalization relationship between the logical object model, so the database structure thus obtained is basically by the parent table. The tree hierarchy of the class and sub-tables, there are very few complex relationships other than inheritance, which is a structure that meets the localization principles, so that the influence of database table data damage is controlled to the system. The daily maintenance work after the opening is convenient. 3. The program and database retrogenization rate is high, and when modifying is less than the mapping application object, there may be a pair of tables and table objects, which may have a pair of table objects after normalizing the relationship mapping. We can see a database object from multiple tables that are normalized by normalization, and a table object mapped. Therefore, when some application requirements are changed, first, the system modification may not involve a portion that is not changed. Second, the modification of the change can be substantially limited to additional or deleting program modules or adding new library tables, and basically does not have to modify the original program code or the original library definition, thereby greatly reduces the workload, reducing the difficulty of work. Sixth, the simplest is the best objective world is intricate, and the development of computer science theory is getting higher and deep, complicated. However, the ultimate goal of human exploration theory and technology is to make the objective world's complexity, the simplest is the best. To this end: 1. Cautious use of foreign key RDBMS support complex relationships is very strong, regardless of how users logically set foreign keys, basically can be implemented from physical help users. However, foreign keys are involved in many independent entities, which not only causes RDBMS to maintain data consistency, but also makes database applications complicated, and aggravation of program development. Such a database is difficult to understand, it is difficult to achieve information concealed design, often complicating simple problems. 2. Appropriate redundant reduction design idea of ​​database redundancy is generated in the 1970s, which is one of the important driving force of DBMS progress. However, as in order to save 2 bytes of storage space, it is the same as the 2000 issue of the headache for the world, it is the product of the computer hardware leading era.

转载请注明原文地址:https://www.9cbs.com/read-610.html

New Post(0)