+5 votes
in Technical issues by (242k points)
Object Oriented Database: The Best Kept Secret of Database Models

1 Answer

+3 votes
by (1.6m points)
Best answer

What are object databases?
Object-oriented databases vs. relational
Advantages and disadvantages of the object-oriented database model


Object Oriented Database: The Best Kept Secret of Database Models

Most people who regularly manage databases, such as software programmers, web developers, or librarians, work with relational databases or with corresponding database management systems (DBMS), such as MySQL or MariaDB. However, there are other alternatives: Object-oriented databases (also called object databases) are rarely used, but they can greatly improve the performance of some projects..

  1. What are object databases?
  2. Object-oriented databases vs. relational
  3. Advantages and disadvantages of the object-oriented database model

What are object databases?

The object-oriented database model groups information into interrelated packages: the data from each record is combined into a single object, with all its attributes. In this way, all the information is available in the object, since its data is grouped instead of distributed in different tables. In objects, not only attributes can be saved, but also methods, which reflects the affinity of these databases with object-oriented programming languages : as in these, each object presents a set of actions that can be carried out finished.

Objects are in turn divided into classes . More specifically, an object is a concrete unit of an abstract class, which creates a hierarchy of classes and subclasses. Within this structure, subclasses take the properties of superordinate classes and supplement them with their own attributes. At the same time, objects in one class can also be related to other classes, breaking the strict hierarchy and allowing networks to be formed. Simple objects can also be combined to create more complex objects..

To manage the various objects, the corresponding object-oriented DBMS automatically assigns a unique identification code to each record, which allows the objects to be retrieved once they have been saved.

Example : in the context of an object-oriented database, we can save a bicycle as an object, with all its attributes and methods: it is red, it can be driven, it has a saddle, etc. This object is part of the class? Bicycles ?, in which, for example, a blue and a green bicycle could also be included. In turn, the class? Bicycles? is a subcategory of "vehicles", which also includes the class "cars". On the other hand, the object is also related to the class? Leisure activities ?. If we access this object through its unique identification code, we will have directly all its methods and attributes..

Object-oriented databases vs. relational

As we have said, relational databases have long been the standard in web development and programming. In this model, the information is stored in related tables . Relationships also allow you to store and query complex information made up of multiple elements, just like in object databases. In the latter, however, all the attributes of each object are immediately available and, in addition, the records can be much more complex. On the other hand, with relational databases, the most common is to try to simplify the information that is entered as much as possible. The more complex the data set becomes, the more extensive the relationships between them, which slows down the database.

Advantages and disadvantages of the object-oriented database model

The database model that we decide to work with will depend a lot on the use we want to give it. Object databases are especially suitable if we are already working with object-oriented programming languages , such as Java, because objects from the source code can be easily integrated into the database. If we resort to a relational database, which is usually the most common, it will be difficult for us to incorporate complex objects into the tabular structure.

One of the drawbacks of this model is that it is not widely used . Although known since the 1980s, only a few DBMS have been developed for object-oriented databases so far. The community dedicated to improving this model is also relatively small. For this reason, most developers prefer to use relational databases, which are generalized, well documented, and much more developed.

What is an advantage in some situations can turn out to be a disadvantage in others: the complexity of the objects ensures that even the most complex queries and annotations can be carried out much faster than in relational models. However, if the processes are simple in comparison, the complex structure cannot be dispensed with, which can lead to slowdown problems .

Advantage Drawbacks
Complex data sets can be saved and queried quickly and easily. The use of object-oriented databases is not very widespread.
Identification codes are automatically assigned to each object. In some situations, high complexity can lead to performance problems.
It works well with object-oriented programming languages.  

There are other alternatives to MySQL and other similar programs: for example, document-oriented databases have proven to be very lightweight and flexible. Column-oriented databases, on the other hand, are very suitable for working with large amounts of data.