This article explores the differences between Object-Oriented Databases (OOMDBs) and Relational Databases (RDBMS), highlighting their strengths and weaknesses and examines how Object-Relational Mapping (ORM) techniques can be used to bridge the gap between Object-Oriented Programming (OOP) and Relational Databases.
Alexander S. Ricciardi
January 30, 2025
![Object to Relational Database on a monitor screen](https://static.wixstatic.com/media/97d138_2f1d855d52a1403094aba85269c25df5~mv2.jpg/v1/fill/w_147,h_80,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_2f1d855d52a1403094aba85269c25df5~mv2.jpg)
Software engineers need to have a good understanding of how Object-Oriented Programming (OOP) relates to Object-Oriented Databases (OBDMS) and Relational Databases (RDBMS) to design efficient software systems. This article explores the core principles of the Object-Oriented concept (OO), the advantages and disadvantages of OBDMS and RDBMS, and Object-Relational Mapping (ORM) techniques for mapping object-oriented data to RDBMS.
Overview of the Object-Oriented Concept
In Software Engineering (SE), the Object-Oriented concept (OO) is a paradigm where systems and real-world entities (e.g. users) are defined as “objects.” These objects are abstractions that, in the context of a software application, encapsulate both data (attributes) and operations that can be performed on that data (methods). The data are the attributes that define the characteristics of the objects and the operation on the data are the methods (procedures or functions) that define the behavior of an object (Colorado State University Global, n.d.). In other words, objects contain both executable code (methods) and data (attributes). OO is composed of six main concepts:
Classification ꟷType of objectꟷ
Abstraction ꟷ Hiding the object's internal implementation details, including some of its attributes and the functionalities of its methods, while representing those attributes and methods internally ꟷ
Encapsulation ꟷDefining the boundary of an object (modularization), defining an object’s attributes and methodsꟷ
Association ꟷRelationships defining objects' interactions with each otherꟷ
Inheritance ꟷRelationships defining objects as a generalization (parents) of other objects (children)ꟷ
Polymorphism ꟷHow objects respond differently to the same message (same method call)ꟷ
The Differences Between OO, OOP, and OODB (ODBMS)
Object-Oriented Programming (OOP) embodies the principles of the OO concept. OOP is a style of programming that encapsulates data (attributes) and code (methods) within classes which are blueprints for creating (instantiate) objects. In other words, the OO approach is a general concept, OOP is a specific way of implementing it. On the other hand, Object-Oriented Databases (OODBs) also called Object Database Management Systems (OBDMS) “store data as objects, similar to how certain programming languages manage data. Instead of tables with rows and columns like traditional databases, object databases use complex data structures to represent data” (MongoDB, n.d.).
Overview of Object-Oriented Database
OBDMS are databases based on the OO paradigm and store data as objects. They are “able to store objects together with their attribute values, operations, and relationships” (Unhelkar, 2018, p.219). The databases store objects “as they are” preserving the object's structure. In SE, this facilitates the design of OO-based software systems, as objects can be loaded directly from the database into memory and executed "as they are." This is useful in software design because, in addition to storing object-based data, OBDMS can directly store (“as they are”) other complex data types like Binary Large Objects (BLOBs) and unstructured data (e.g., video and audio). Unlike relational databases that use a tabular (rows and columns) format, which is not suited for storing these two data types. OBDMS have several other advantages besides storing complex data, as well as disadvantages, the table below lists these advantages and disadvantages.
Table 1
ODBMS Advantages and Disadvantages
![ODBMS Advantages and Disadvantages](https://static.wixstatic.com/media/97d138_f4283aa7218b4bb18dade78b762e7fe6~mv2.jpg/v1/fill/w_147,h_201,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_f4283aa7218b4bb18dade78b762e7fe6~mv2.jpg)
Note: The table lists the advantages and disadvantages of Object Database Management Systems (ODBMS). From several sources (Colorado State University Global, n.d.; Unhelkar, 2018; Worldlovely, 2024; Akshitakumawat, 2023)
As shown by Table 1, OBDMS are ideal for storing complex data such as complex unstructured data (AD/CAM, multimedia, scientific databases). However, they lag the standardization, the simplicity, and the relatively low cost found in Relational Databases Management Systems.
Overview of Relational Database
Relational Databases (RBs) also called Relational Databases Management Systems (RDBMS) are databases that store and organize predefined relationships in the form of tables that store data points in pre-defined categories through rows and columns (Microsoft, n.d.; Google n.d.). Relationships are established through logical connections between tables, typically using primary keys and foreign keys. RDBMS structure data based on these relationships, making it easier to query and manage data using Structured Query Language (SQL). RBMS uses the concept of primary key and foreign key. A primary key is a unique identifier for each record in a table (each row) (InterSystems, n.d.). A foreign key establishes a link between two tables, allowing related data to be accessed using the keys. RBMS have several advantages and disadvantages, the table below lists some of them.
Table 2
RDBMS Advantages and Disadvantages
![RDBMS Advantages and Disadvantages](https://static.wixstatic.com/media/97d138_0bf76f0430524dd9b63889db3e731668~mv2.jpg/v1/fill/w_147,h_180,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_0bf76f0430524dd9b63889db3e731668~mv2.jpg)
Note: The table lists the advantages and disadvantages of Relational Databases Management Systems (InterSystems, n.d.; Pedamkar, 2023; EASA, 2022; Google, n.d.; OCI, 2021; Singh; 2024, Pedamkar, 2023; Goray, 2012)
RDBMS can be used to store object-based data; however, they store data in tables that are structurally different from objects, requiring objects to be translated from classes to tables (Unhelkar, 2018). Additionally, the data and behavior represented by a class cannot be directly transferred to a table because relational databases can only store data. However, it is possible to map object-oriented designs into RDBMS, but it is a difficult task.
Mapping Objects to RDBMS
Object-Relational Mapping (ORM) is a technique that bridges the gap between OOP and RDBMS (Rajputtzdb, 2024). One of the simplest ORM forms of mapping is one-to-one mapping, where classes are mapped to tables, class attributes are mapped to the table columns, and the instantiated objects are mapped to rows in the corresponding table. See Figure 1 for an example of it.
Figure 1
RDBMS Object Mapping
![RDBMS Object Mapping](https://static.wixstatic.com/media/97d138_e5bd748d3bd74ee69bf96a35caa874a2~mv2.jpg/v1/fill/w_147,h_55,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_e5bd748d3bd74ee69bf96a35caa874a2~mv2.jpg)
Note: The figure depicts how objects are mapped to RDBMS table using the ORM One-To-One mapping form.
To map and simulate object behavior with RDBMS ORM combined with the CRUD functions can be implemented. ORM the association relationships between classes using the foreign key in tables. The figure below depicts how foreign keys emulate the association relationship between classes
Figure 2
Foreign Keys and OO Association Relationship
![Foreign Keys and OO Association Relationship](https://static.wixstatic.com/media/97d138_aad5df7d0fbe40d4af11675fbc0c3ba8~mv2.jpg/v1/fill/w_147,h_48,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_aad5df7d0fbe40d4af11675fbc0c3ba8~mv2.jpg)
Note: the figure depicts how foreign keys emulate OO association relationships.
To emulate the aggregation and other association relationships within RDBM, CRUD functions which stand for
Create—creates an object.
Read—search for an object (record) from storage based on a criterion (key).
Update—search and update objects (records).
Delete—locates and remove a persistent object
(Unhelkar, 2018)
These operations are executed using languages such as SOL. The figure below depicts a class diagram illustrating how CRUD operations and association relationships are linked to RDBMS.
Figure 3
CRUD and RDBMS Class Diagram
![CRUD and RDBMS Class Diagram](https://static.wixstatic.com/media/97d138_f4a18bbef76146e9b9a75108fd7d6f16~mv2.jpeg/v1/fill/w_147,h_94,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/97d138_f4a18bbef76146e9b9a75108fd7d6f16~mv2.jpeg)
Note: The figure depicts a class diagram illustrating how CRUD operations are emulated within objects and how association relationships are linked to RDBMS using CRUD and key attributes.
To summarize, Object-Oriented Databases (ODBMS) directly support object data types; on the other hand, Relational Databases (RDBMS) are prevalent due to their widely adopted standards and robustness; however, they store data in tables that are structurally different from objects, requiring objects to be translated from classes to tables. Nonetheless, Object-relational mapping (ORM) allows RDBMS to effectively manage object-oriented data by bridging the gap between objects and tables.
References:
Akshitakumawat (2023, May 1). Definition and Overview of ODBMS. GeeksForGeeks. https://www.geeksforgeeks.org/definition-and-overview-of-odbms/
Colorado State University Global (n.d.). Module 7.1 Data Storage Mechanisms. [Interactive lecture]. CSC470 Software Engineering, CSU Global, Departement of Computer Science. Canvas. Retrieved January 29, 2025, from: https://csuglobal.instructure.com/courses/104036/pages/7-dot-1-data-storage-mechanisms?module_item_id=5372300
EASA (2022, January 25). 8 advantages of a Relational Database. EASA Blog. https://www.easasoftware.com/insights/8-advantages-of-a-relational-database/
Google (n.d.). What is a relational database? Google Cloud. https://cloud.google.com/learn/what-is-a-relational-database
InterSystems (n.d.). What is a relational database and why do you need one? InterSystems. https://www.intersystems.com/resources/what-is-a-relational-database/
Microsoft (n.d.). What is a relational database? Microsoft Azure. https://azure.microsoft.com/en-us/resources/cloud-computing-dictionary/what-is-a-relational-database
MongoDB (n.d.). The basics of object-oriented databases. MongoDB. https://www.mongodb.com/resources/basics/databases/what-is-an-object-oriented-database#:~:text=An%20object%2Doriented%20database%20stores,data%20structures%20to%20represent%20data.
OCI (2021, June 18). What is a relational database? (RDBMS)? Oracle. https://www.oracle.com/database/what-is-a-relational-database/
Pedamkar, P. (2023, July 6). Relational database advantages. EDUCBA. https://www.educba.com/relational-database-advantages/
Rajputtzdb (2024, February 28) What is Object-Relational Mapping (ORM) in DBMS?
Singh, P. (2024, April 24). 15 Advantages and Disadvantages of RDBMS. Internshala Trainings
Goray, S. (2021, December 10). Top 10+ Advantages and Disadvantages of Using RDBMS. WAC. https://webandcrafts.com/blog/advantages-disadvantages-rdbms
Unhelkar, B. (2018). Chapter 13 — Database modeling with class and sequence diagrams. Software engineering with UML. CRC Press. ISBN 9781138297432
Worldlovely (2024, December). Database management system [Discussion Post]. Hack The Forum. https://www.hacktheforum.com/database-management-system/object-oriented-dbms/#google_vignette