Essence of OODB
The essence of the object-oriented database is determined by the object-oriented approach (Figure 7.1), which implies object-oriented design and object-oriented programming.
Fig. 7.1. Object-oriented approach
Object-oriented design - a design methodology that combines the process of object decomposition and the methods of representing logical and physical, as well as static and dynamic models of the projected system.
Object-oriented programming is a programming methodology based on the representation of programs in the form of a linked collection of objects, each of which is an instance of a particular class, and classes form a hierarchy by inheritance.
Object-oriented design involves not only dividing (decomposing) the knowledge base or database into component parts (Figure 7.2), but also considering the overall stage of implementation of the database, selecting the implementation tool, taking into account the implementation options specified in the technical assignment.
Fig. 7.2. Object-oriented design
Object-oriented programming takes as its basis the model of the atomic element (Figure 7.1).
The fact is that, despite powerful debugging tools, it is advisable to debug programs sequentially, in blocks, to improve the performance of the programming procedure. The program as a whole is debugged faster if the blocks have been debugged in advance. These assumptions are also used as the basis for object-oriented programming.
Any mathematical model has the form shown in Fig. 7.1, and the complex one in Fig. 7.3.
There are several specific concepts. Class is actually some block with a structure (see Figure 7.1), However, here we use a slightly different terminology. The data is called properties , and the algorithms are methods. The class is accessed through properties - in the static mode of writing and debugging a program or through methods - while the program is running.
The beginning of the class is defined using special internal (for example, pressing a button) or external (calling from another subroutine) signals, called events.
A software implementation of a class is called a component. The implementation of a component in some application program is called an object.
There are three main principles in object-oriented programming: encapsulation, inheritance, polymorphism.
Encapsulation - select a class with access to it through properties or methods.
Fig. 7.3. Object-oriented programming
Inheritance - transforming a class by changing properties and methods using methods called a constructor and destructor.
All classes (components) are built on a hierarchical basis with an origin from some original class.
Polymorphism allows you to use a method with the same name in both the base class and the derived classes. The fact is that the number of classes is significant: already now it is approaching one hundred and continues to grow. If you use for derived classes for the same type, similar methods (for example, the drawing of a square and a circle) different names, it will be difficult for a user, especially a beginner, to learn with such a variety of names.
Here are the main provisions of OODB, based on the object-oriented approach.
1. An arbitrary tuple can be used as the column value. In other words, the column can be, as it were, some other table. Thus, it is possible to implement tables with a non-linear structure.
2. The procedure for manipulating data allows you to attach procedures defined by column values.
3. Column data can be inherited.
4. Elements of relations can serve only as separate elements, as in relational databases, but also sets.
5. Formats the data classes that organize the columns into a hierarchy.
The basic language of OODB is most often C ++. To work with such OODBs, a new version of the SQL programming language is developed, called SQL3 and containing the relational model (SQL2) as a particular case. If SQL2 defines seven ways of binding to standard programming languages, this number is supposed to be increased in SQL3.
Two directions compete in OODB development technology.
• Microsoft's Distributed Object Linking and Embedding (OLE).
• OBDMG's Common Object Request Broker Architecture (CORBA), supported by IBM, Novell, DEC, targeting all platforms. Within the framework of this direction, the previously defined object definition language Object Definition Language (ODL) is selected and formed; Object query language Object Query Language (OQL); interface definition language Interface Definition Language (IDL).
In the second direction, two standard DB management standards are usually distinguished :
• ODL/OQL, in which objects and methods are usually created using the C programming language;
• SQL3 programming language, some features of which are described in Ch. 9.
It should be noted that it is possible to attribute to object-oriented only those databases in which all the structural elements of the implementation (see Figure 7.2) are constructed using the object-oriented approach. If at least one structural element of the implementation does not use the object-oriented approach, we speak about the object-relational database (DBMS), which will be presented in more detail in Ch. 8.
Thus, in order to take advantage of the object-oriented approach in building the database itself, it is necessary:
1) encapsulate data, i.e., select classes and objects;
2) determine the possible types of the structure of the tables being implemented;
3) create inheritance of data classes;
4) Ensure polymorphism.
The implementation of even the first position is ambiguous and different, for example in OODBMS and ORDBMS. There is some difference even within the framework of different OODBMS.
In various OODBs, there is a somewhat different set of properties, at least in terms of terminology. At the same time, there is no significant difference between the sets of properties, and therefore we illustrate them using the example of the CACHE OODBMS.
It distinguishes data type classes and data classes (object classes, tables).
If we draw an analogy with the terms of a relational database, then the term class (object) The OODB corresponds roughly to the concept of table & quot ;, and the concept property - field (column) of the table .
Constants, object references, built-in objects, data streams (BLOB and CLOB), collections as arrays and lists, and multidimensional properties are assumed as properties [38, 40]. Properties include relationships between objects.
There are types for properties, the main ones of which are Currency, Date, Float, Integer, List, Name, Numeric, Status, String.
As the types of properties can act connections that [40 | can be divided into simple, implemented by links, and relationships, sometimes called associations. When referring as a property type, the class (object) with which this property is associated appears. It is possible to embed one object in another. In associations, ONE-TO-MANY (1: M) and PARENT-CHILDREN (parent-children) relations are singled out.
There are three main groups of methods: count (in Cache ObjectScript), an expression (a code fragment, called by value), a call. It is not difficult to see that the data of cells are not atomic.
The OODB structure can be constructed in various ways: using the visual language, Cache ObjectScript, SQL programming languages.
In other OO-DBMS, C ++ is often used for these purposes.
The OODB within the OLTP and OLAP system interacts with a multidimensional data model (MMD). We will discuss the specifics of MMD.