Abdulhakim ADBS
Abdulhakim ADBS
Name-------------------------------------ID
Abdulhakim Michael--------------0466/16
Key Features
• Objects as Data Units: Unlike relational databases, which use tables with
rows and columns, OODBs store data as objects that can contain attributes,
methods, and even other objects. This mirrors how objects are used in
languages like Java or C++.
• Complex Data Handling: OODBs excel at managing intricate data types
such as multimedia (images, videos) or hierarchical structures without the
need to flatten them into tables.
• Integration with Programming: By aligning with OOP, OODBs reduce the
impedance mismatch, the disconnect between a database’s data model (e.g.,
tables) and a programming language’s data model (e.g., objects). This
eliminates the need for extensive mapping layers.
Advantages
• Natural Relationships: Relationships between entities (e.g., a book and its
author) can be modeled directly, with objects referencing each other, rather
than relying on foreign keys and joins.
• Behavior Inclusion: Objects can include methods (e.g., a Book object with a
borrow() method), embedding logic within the data itself.
• A Book object might have attributes like title and publicationYear, a reference
to an Author object, and a method checkAvailability().
• This contrasts with a relational database, where books and authors would be
separate tables linked by IDs, requiring joins to combine data.
❖ Object Identity
❖ Object Structure
❖ Type Constructors
Example:
A BankAccount object might have attributes like accountNumber and balance, and
methods like deposit(amount) or withdraw(amount). These methods enforce rules
(e.g., checking for sufficient funds before a withdrawal) directly within the database,
rather than relying on external code.
Example:
In a university database, a Student object might reference a Course object via its
OID. When the Student object is persisted, this reference is maintained, ensuring the
relationship remains intact without requiring explicit joins or foreign keys, as in
relational databases.
Note: Unlike relational databases, where persistence involves mapping data to tables
and operations are external, OODBs store both data and methods together, providing
a more unified approach to data management.
Type hierarchies allow data types (or classes) in an OODB to be organized into a
structured hierarchy, where types can inherit properties and behaviors from other
types. This mirrors the class hierarchies in object-oriented programming, enabling a
more modular and reusable database design.
Example:
In a university database, a supertype Person might include attributes like name and
address, and a method like updateAddress(). Subtypes Student and Professor inherit
these properties, adding their own attributes such as studentID for Student or
department for Professor.
Inheritance Mechanisms
Inheritance allows subtypes to reuse and potentially modify the attributes and
methods of their supertypes.
Example:
A TeachingAssistant might inherit enrollCourse() from Student and assignGrade()
from Professor. If both supertypes define a method like getRole(), the OODB must
specify which version is used or allow the subtype to override it.
✓ Key Difference
• Relational databases lack native inheritance support, requiring work
arounds like separate tables per subtype or a single table with type flags.
• OODBs provide built-in inheritance, making hierarchical relationships
more efficient and elegant.