Object-oriented databases: the insider tip in database models
Most people who regularly deal with databases – for example, those working in software programming, web development or the library sector – work with relational databases and with corresponding database management systems (DBMS) like MySQL or MariaDB. But there are alternatives and one of these are object-oriented databases (also known as object databases or OODBs). Although OODBs are not be widely used, they can be a great help to some projects.
What are object databases?
The object-oriented database model ties related packages together. In other words, a data set and all its attributes are combined with an object. In this way, all of the information is directly available. Instead of distributing everything across different tables, then, the data can be retrieved in one package. Alongside the attributes, methods are also stored in the objects. This is where the databases’ proximity to object-oriented programming languages becomes clear. As in programming, each object has certain activities that it can carry out.
In turn, objects are brought together in classes. Or, to put it more accurately: an object is a concrete unit in an abstract class. This generates a hierarchy of classes and subclasses. Within such a construct, subclasses assume the properties of higher-level classes and expand on these with their own attributes. At the same time, objects in one class can also be connected with other classes. This breaks up the strict hierarchy and makes sure that the objects are interlinked. Simple objects can be combined with complex objects.
To address the various objects, the corresponding database management system automatically assigns a one-off identification to each unit. In this way, objects can be easily retrieved again after they have been saved.
Let’s look at an example. Assume we are saving the concrete object of a bicycle as an object-oriented unit with all of its properties and methods. It is red, you can ride it, it has a saddle, and so on. This object is then simultaneously part of the class ‘Bicycles’. Inside the same class, for example, we might also find a blue and a green bicycle. The class ‘Bicycles’ is in turn a subcategory of ‘Vehicles’, which also contains ‘Cars’. At the same time, however, the object also has a connection to the class ‘Leisure activities’. If we retrieve our object via its unique ID, all of its related attributes and methods are directly available.
Relational vs. object-oriented databases
For a long time, relational databases have been the standard in web and software development. In this model, information is stored in interconnected tables. Here, too, the links between complex pieces of information with different components can be stored and retrieved. With an object database, though, all of the unit’s components are available immediately. That also means that the data sets can be much more complex. With a relational database we tend to try to accommodate simple information. The more complex the data set becomes, the more extensive the connections, obstructing the database.
Advantages and disadvantages of the object-oriented database model
The choice of database type heavily depends on the individual application. When working with object-oriented programming languages, like Java for example, an object database is advantageous. The objects of the source code can simply be incorporated into the database. If we turn to a relational database, which is fairly common, complex objects are more difficult to integrate into the table construct.
One disadvantage of OODBs is poor adoption among the community. Although the model has been established since the 1980s, up to now, very few database management systems have taken to object databases. The community that works with the model is correspondingly small. Most developers, therefore, prefer to turn to the more widely spread, well-documented and highly developed relational databases.
Although complexity of OODBs is one of its advantages, it can present a few disadvantages in certain situations. The complexity of the objects means that complex queries and operations can be undertaken much more quickly than in relational models. However, if the operations are simple, the complex structure still has to be used resulting in a loss of speed.
|Complex data sets can be saved and retrieved quickly and easily.||Object databases are not widely adopted.|
|Object IDs are assigned automatically.||In some situations, the high complexity can cause performance problems.|
|Works well with object-oriented programming languages.|
There are other alternatives to MySQL & co., including document-oriented databases, which have proven to be very flexible. Column-oriented databases, on the other hand, are used above all when dealing with very large amounts of data.