DDB UNIT - 5
DDB UNIT - 5
Composition (Aggregation):
• Instance Variables:
• Some variables hold simple values (e.g., model, year).
• Others are object-based, like the make attribute, which links to objects of type Manufacturer.
• Composite Objects:
• A type like Car that links to other objects (e.g., Manufacturer) is called a composite type.
• Composite objects allow sharing of linked objects, known as referential sharing.
• Example: If John and Mary both own the same car (c1), it’s due to referential sharing.
• Complex Objects:
• Composite objects allow sharing, but complex objects do not.
• Example: A car (c1) and another car (c2) wouldn’t share the same tires because it’s
unrealistic for tires to belong to multiple vehicles at the same time.
• Representation:
• Relationships between composite objects can be shown using a composition graph (or
hierarchy for complex objects).
• In such graphs, an edge connects a variable of one type to another type when the variable’s
domain is the other type.
• The distinction between composite and complex objects is important, even if it’s not always
emphasized.
• Since data and procedures are encapsulated as objects, the unit of communication between the
clients and the server is an issue. The unit can be a page, an object, or a group of objects.
• Closely related to the above issue is the design decision regarding the functions provided by
the clients and the server. This is especially important since objects are not simply passive
data, and it is necessary to consider the sites where object methods are executed.
• In relational client/server systems, queries are sent from the client to the server, which
processes them and returns result tables—a process called function shipping. In object-
oriented client/server DBMSs, this approach may not be ideal due to the need for data
shipping, where data is moved to clients for navigating complex object structures.
• This creates challenges in managing client cache buffers for data consistency, which is
closely tied to concurrency control since cached data may be shared across multiple clients.
Most commercial object DBMSs use locking mechanisms for concurrency control, raising
architectural questions about where locks should be placed and whether they should also be
cached on clients.
• Additionally, due to the composite nature of objects, prefetching component objects when
an object is requested may be beneficial. Unlike relational systems, which rarely prefetch
data, object DBMSs might leverage prefetching to improve performance.
1. Object Servers
2. Page Servers
The distinction is partly based on granularity of data that are shipped client and server , partly based
on Functionality.
• Simplify DBMS code by maintaining uniform object representation across server, client, and
disk.
• Updates occur in client caches and are flushed to the server for persistence.
• Fully utilize client workstation power, reducing server bottlenecks.
• Servers handle fewer functions, allowing them to serve more clients efficiently.
• Work distribution between server and clients can be optimized by the query optimizer.
• Exploit operating systems and hardware functionalities, such as pointer swizzling.
• Apply locking and logging at the object level, enabling multiple clients to access the same
page for small objects.
• Reduce data transmission by filtering objects at the server instead of sending entire pages.
• Mixed workloads involve both query access and object navigation, making server-side
navigation inefficient due to frequent remote procedure calls (RPCs).
• Navigation-heavy workloads favor page servers.
• Code Shipping as a Solution:
• User applications can be shipped to servers for execution, reducing the need for frequent data
transfers (data shipping).
• Requires safe execution environments (e.g., safe languages like in the Thor system) to
maintain DBMS safety and reliability.
• Divided execution increases concerns over cache consistency between client and server.
• Function Shipping:
• Combines client and server resources for query and application execution, accommodating
mixed workloads.
• Supports a move toward peer-to-peer architectures with distributed execution.
• Dynamic Architecture Switching:
• Some systems can switch between architectures. For example, O2 operates as a page server
but switches to object shipping when page conflicts increase.
• Open Research and Challenges:
• Performance studies have not conclusively defined trade-offs between page and object
servers.
• Complexity increases for objects like multimedia documents that span multiple pages.
• Clients request objects from the server, which retrieves and sends them to the client.
• Server handles most DBMS services; clients provide an execution environment and some
object management functionality.
• Object management layer is duplicated on both client and server for executing methods at
both locations.
• Object manager responsibilities include:
o Providing a context for method execution.
o Handling object identifiers (logical, physical, or virtual) and object deletion (explicit
or garbage collection).
o Supporting object clustering and access methods at the server.
o Implementing object caches at both client and server to improve performance by
reducing server accesses.
• Group Object Transfers:
• Servers can send groups of objects instead of individual ones.
• Groups can be contiguous or span multiple pages, based on prefetching hints from the client.
• Group sizes are dynamically adjusted based on group hit rates.
• Handling Updates:
• Updated objects from clients must be installed onto their home pages in the server.
• If the home page is not in the server buffer, an installation read is performed to reload the
page.
• Performance Comparisons:
• Early studies favored page server architectures, especially when data clustering matches
access patterns.
• Object server architectures perform better when access patterns do not align with clustering.
• More research is needed for a conclusive judgment, particularly for multi-client/multi-server
environments.
• Advantages of Page Servers:
• Simplifies DBMS code with uniform object representation from disk to user interface.
• Updates occur in client caches and are reflected on disk when pages are flushed.
• • Simplify DBMS code by maintaining uniform object representation across server, client,
and disk.
• Updates occur in client caches and are flushed to the server for persistence.
• Fully utilize client workstation power, reducing server bottlenecks.
• Servers handle fewer functions, allowing them to serve more clients efficiently.
• Work distribution between server and clients can be optimized by the query optimizer.
• Exploit operating systems and hardware functionalities, such as pointer swizzling.
• Advantages of Object-aware Servers:
• Apply locking and logging at the object level, enabling multiple clients to access the same
page for small objects.
• Reduce data transmission by filtering objects at the server instead of sending entire pages.
• Challenges in Object DBMSs:
• Mixed workloads involve both query access and object navigation, making server-side
navigation inefficient due to frequent remote procedure calls (RPCs).
• Navigation-heavy workloads favor page servers.
• User applications can be shipped to servers for execution, reducing the need for frequent data
transfers (data shipping).
• Requires safe execution environments (e.g., safe languages like in the Thor system) to
maintain DBMS safety and reliability.
• Divided execution increases concerns over cache consistency between client and server.
• Function Shipping:
• Combines client and server resources for query and application execution, accommodating
mixed workloads.
• Supports a move toward peer-to-peer architectures with distributed execution.
• Performance studies have not conclusively defined trade-offs between page and object
servers.
• Complexity increases for objects like multimedia documents that span multiple pages.
Clients in distributed systems can manage three types of buffers: page buffers, object buffers, and
dual page/object buffers, each with distinct characteristics:
1. Page Buffers:
o Manage entire pages of data.
o Suitable for bulk data transfer but may waste buffer space if application access
patterns don't align with disk data clustering.
2. Object Buffers:
o Handle individual objects, allowing fine-grained access and better concurrency.
o Risk of buffer fragmentation due to unused buffer space when objects don't fit evenly.
3. Dual Page/Object Buffers:
o Combine the benefits of both page and object buffers.
o Pages are loaded into the page buffer, and useful objects are copied to the object
buffer when a page is flushed.
o This approach balances efficient access and space utilization.
Server buffer management in distributed object DBMS is similar to relational systems but with
object-specific optimizations:
• Page Buffer Management: Servers manage a page buffer, sending relevant pages to clients
based on their requests.
• Modified Object Buffer (MOB): Stores updated objects returned by clients. These objects
are installed back into their corresponding data pages, reducing disk I/O by batching
read/write operations.
• Buffer Replacement Policy: Servers often use the "LRU with hate hints" policy, marking
pages cached by clients as "hated" and evicting them first to reduce data duplication.
Cache consistency ensures that client-cached data remains synchronized with the server. Two main
strategies are used:
1. Avoidance-based Algorithms: Prevent stale data by restricting updates when data is
accessed by other clients.
2. Detection-based Algorithms: Allow stale data access but validate data consistency at
commit time.
Algorithms are further classified based on when clients notify the server of updates:
1. Avoidance-based Synchronous:
o Callback-Read Locking (CBL): Clients retain read locks but relinquish write locks
after transactions. It minimizes abort rates and outperforms most alternatives.
2. Avoidance-based Asynchronous:
o Asynchronous Avoidance-Based Cache Consistency (AACC): Clients send lock
requests but proceed without blocking. This reduces deadlock rates.
3. Avoidance-based Deferred:
o Optimistic Two-Phase Locking (O2PL): Clients batch lock requests and send them
at commit time, though it risks high deadlock rates with increased contention.
4. Detection-based Synchronous:
o Caching Two-Phase Locking (C2PL): Clients check data freshness on every access.
Its performance is generally lower due to frequent server checks.
5. Detection-based Asynchronous:
o No-Wait Locking (NWL): Clients assume lock success and proceed, with the server
later notifying them of updates. It has lower performance than CBL.
6. Detection-based Deferred:
o Adaptive Optimistic Concurrency Control (AOCC): Clients defer lock
notifications until commit time. It performs well in data-intensive environments with
reduced messaging overhead, despite higher abort rates.
Object Management:
• object identifiers (OIDs) are system-generated and used to uniquely identify every object
(transient or persistent, system-created or user-created) in the system.
• Implementation of persistent object has 2 common solutions based either on Physical or
logical identities.
• Physical Identifier POID approach equates the OID with the physical address of the
corresponding object. The address can be disk space address and an offset from the base
address in the page.
• The address can be a disk page address and an offset from the base address in the page.
• The advantage is that the object can be obtained directly from the OID.
• The drawback is that all parent objects and indexes must be updated whenever an object is
moved to a different page.
Logical Identifier:
• The logical identifier (LOID) approach consists of allocating a system-wide unique OID (i.e.,
a surrogate) per object.
• OIDs are invariant; there is no overhead due to object movement.
• Overhead can be avoided by an OID table associating OID with physical object address
at the expense of one table look-up per object access.
• The ODBMS system prefer logicial identifier because it supports dynamic
environment.
• In transisent objects OID can be physical or logical.
• The physical identifier approach is the most efficient, but requires that objects do not move.
• The logical identifier approach, promoted by object-oriented programming, treats objects
uniformly through an indirection table local to the program execution.
• This table associates a logical identifier, called an object oriented pointer (OOP)
• LOID Generation:
LOIDs (Logical Object Identifiers) must be unique across an entire distributed domain.
Centralized LOID generation ensures uniqueness but is undesirable due to network latency and
high load on the central site.
In multi-server environments, each server generates LOIDs for objects stored locally.
LOID uniqueness is ensured by combining a server identifier and a sequence number.
The server identifier distinguishes LOIDs generated by different servers.
The sequence number uniquely represents the disk location of an object within a server.
Sequence numbers are not reused to avoid issues such as:
• Deleted object references inadvertently pointing to newly created objects using the same
sequence number.
B+-trees support range queries, making them suitable for accessing collections of objects.
2. Pointer Swizzling:
• Path expressions enable navigation between objects in object systems, resembling pointers (e.g.,
c.engine.manufacturer.name).
• On disk, object identifiers represent pointers, while in memory, in-memory pointers are
preferred for efficiency.
• Pointer-swizzling is the process of converting disk-based pointers to in-memory pointers.
• Two types of pointer-swizzling mechanisms exist:
• Hardware-based schemes:
o Use the operating system's page-fault mechanism.
o Swizzle all pointers in a page upon loading into memory.
o Provide better performance for repeated traversals of object hierarchies (no indirection
for object access).
o Have disadvantages:
▪ High overhead during page faults in poorly clustered data.
▪ Potential access to deleted objects.
▪ Risk of exhausting virtual memory address space.
▪ Limited support for object-level concurrency, buffering, data transfer, and
recovery.
• Software-based schemes:
o Use an object table for swizzling pointers.
o LOIDs are swizzled to point to the table location.
o Variants:
▪ Eager swizzling: Converts pointers immediately.
▪ Lazy swizzling: Converts pointers when needed.
o Introduces a level of indirection for object access.
• Software-based schemes are better suited for object-level operations and allow more granular
control.
• The choice between schemes depends on factors like clustering quality, data access patterns, and
concurrency requirements.
Object Migration:
• In distributed systems, objects may move between sites, raising several challenges.
• Unit of migration:
• Object state can migrate without methods, requiring remote procedure calls for method
application.
• Relocated objects might be separated from their type specifications.
• Solutions for migrating classes (types):
1. Move and recompile source code at the destination.
2. Migrate compiled class versions like any object.
3. Move source code only, with a lazy migration of compiled operations.
• Directory updates can be lazy (on redirection via proxies) or eager (at the time of movement).
• Object Model:
• Object models are conceptual and aim to improve programmer productivity.
• Translating conceptual models to physical storage is a common database challenge.
• Key Relationships in Object DBMSs:
• Sub typing: Defines relationships between parent and child types.
• Composition: Groups objects based on shared attributes or as sub-objects of the same parent.
• Object Clustering:
• Groups related objects in physical storage for faster access.
• It is complex due to:
o Object Identifier Types:
▪ LOID (Logical OID): Allows class partitioning but adds overhead.
▪ POID (Physical OID): Enables direct access but includes inherited attributes.
o Shared Objects: Objects with multiple parents increase complexity.
• Storage Models for Object Clustering:
• Decomposition Storage Model (DSM):
o Breaks objects into pairs (OID, attribute).
o Simple but relies on LOID.
• Normalized Storage Model (NSM):
o Stores each class separately.
o Works with both LOID and POID; LOID allows inheritance-based partitioning.
• Direct Storage Model (DSM):
o Clusters multi-class objects by composition.
o Best for known access patterns but struggles when parent objects are deleted.
• Distributed System Implementation:
• DSM and NSM: Use horizontal partitioning in distributed systems.
• Goblin: Implements DSM with large memory and caching for flexibility.
• Eos:
o Uses direct storage with system-wide POID.
o Adapts dynamically for load balancing and object movement, avoiding overhead.
• Managing object updates or deletions in complex relationships.
• Ensuring performance in dynamic environments like distributed systems.
• Reference Counting:
o Each object tracks the number of references to it.
o Memory is freed when the reference count drops to zero.
o Problem: Cannot handle mutually-referential objects (cyclic garbage).
• Tracing-Based Algorithms:
o Mark and Sweep:
▪ Mark phase: Marks all reachable objects.
▪ Sweep phase: Deletes unmarked (unreachable) objects.
o Copy-Based Collectors:
▪ Divides memory into two areas (from-space and to-space).
▪ Copies reachable objects to the empty area and compacts memory.
o Both methods are stop-the-world (suspend programs during collection).
• Difficulties:
o Objects may have references across multiple sites, complicating collection.
o Distributed systems face issues like message loss, duplication, or delays.
• Methods:
o Distributed Reference Counting:
▪ Tracks references across sites but fails with message order issues or cycles.
▪ Variants like "reference listing" address some failures but not cyclic garbage.
o Distributed Tracing:
▪ Combines local collectors with a global inter-site collector.
▪ Relies on inconsistent information due to communication delays.
• Research Solutions:
o Algorithms like those by Ferreira and Shapiro (1994) reclaim garbage cycles across
distributed spaces.
________________________________________________________________
Object Query Processor Architectures:
• Query Optimization as an Optimization Problem:
• Query optimization selects the "optimum" state (algebraic query) in a search space of
equivalent queries, using a cost function.
• Query processors vary in how they model the search space, cost functions, and
transformation rules.
• Architectures of Object DBMS Optimizers:
• Many optimizers are integrated into the object manager or implemented as client modules
in client/server architectures.
• Most are "hardwired," limiting their extensibility across various components.
• Need for Extensibility:
• Extensible optimizers can support diverse search strategies, algebra specifications,
transformation rules, and cost functions.
• Rule-based optimizers allow adding new transformation rules but lack extensibility in
other dimensions.
• Extensibility Through Modularization:
• Modularization can achieve extensibility by separating components like:
o User query language parsing from operator graphs.
o Algebraic operator manipulation from execution algorithms.
• This separation enables changes to one module (e.g., query language or optimization
method) without affecting others.
• Search Space Extensibility:
• Search space can be divided into regions, each representing a family of equivalent query
expressions.
• Regions may differ in transformation rules, optimization objectives (e.g., cost
minimization or form transformation), and search strategies.
• Object-Oriented Approach for Extensibility:
• Using object-oriented design, components like queries, classes, operators, and cost
functions are treated as first-class objects.
• This approach simplifies the addition of new operators, transformation rules, and operator
implementations, enhancing flexibility and extensibility.
• ODBMS use a query processing method similar to relational database, but differ in
details due to the unique object and query methods.
Here we focus on
i) Algebraic Optimization.
ii) Path Expressions.
iii) Query Execution.
1. Algebraic Optimization
differing from relational systems because objects have subclass and composition
relationships.
o Unique rules include:
o C1∩C2=∅, if c1≠c2 No object can belong to two different classes.
o C1∪C2=C2, if C1 is a subclass of C2.
Ensures inheritance-based unions include all subclass objects.
o Parameterized select (R(PσF⟨QSet⟩)∩R simplifies into (PσF⟨QSet⟩)∩(RσF′⟨QSet>),
based on type consistency and rule conditions.
2. Search Algorithm:
o Enumerative Algorithms:
▪ Relies on dynamic programming, useful for limited joins.
▪ Inefficiency arises when queries exceed 10 joins (as noted by Ioannidis and
Wong, 1987).
o Randomized Search Algorithms:
▪ Proposed as alternatives to reduce search space.
▪ These lack extensive research and distributed algorithm implementations.
3. Cost Function:
o Relational systems define cost functions using system catalogs (e.g., cardinality,
indexing).
o In object DBMSs:
▪ Cost functions require additional information due to encapsulation (e.g.,
internal object structure may be hidden).
▪ Recursive cost calculations are based on algebraic trees.
▪ Objects can "reveal" costs through interfaces, enabling optimizations.
o Abstract definitions of costs and optimization rules remain areas for further study.
2. Path Expressions
1. Definition:
o Path expressions represent object reference chains, such as
c.engine.manufacturer.name, used to retrieve deeply nested values.
o Includes attributes, methods, and complex predicates.
2. Optimization of Path Expressions:
o Recognized during query parsing or algebraic optimization phases.
o Rewritten into logical algebra expressions for optimization, enabling efficient
execution (e.g., using indexed scans or joins).
3. Rewriting and Algebraic Optimization:
o Example: The path expression c.engine.manufacturer.name involves:
▪ Links to retrieve Engine and Manufacturer objects from disk.
▪ Optimizations focus on these retrieval steps.
o Techniques:
▪ Type-based rewriting decomposes complex expressions into simpler joins
and indexed scans.
▪ Materialize (Mat) Operator:
▪ Defines "scope" of path expressions for predicate evaluation or
algebraic transformations.
▪ Enables optimized grouping or individual handling of materialized
objects.
3. Query Execution
Path Indexes:
1. Indexing Techniques:
o Path indexes improve path expression execution.
o Examples:
▪ Join indexes: Use relationships between objects for optimized joins.
▪ Access support relations: Store frequently traversed paths for faster lookups,
improving query performance by up to two orders of magnitude.
o Maintenance costs of these structures arise during updates to underlying data.
2. Set Matching
1. Join Algorithms:
o Hybrid-Hash Join:
▪ Uses hashing to partition operand collections into smaller buckets that fit in
memory.
▪ Efficiently joins bucket pairs in memory.
o Pointer-Based Hash Join:
▪ Utilizes object pointers for direct referencing.
▪ Steps:
1. Partition operand RRR by OID (Object Identifier) values.
2. Build a hash table for RRR based on its pointers to SSS.
3. Match objects in RRR with those in SSS via pointer-based hash table
entries.
o Both algorithms are centralized, with no distributed counterparts.
2. Assembly Operator:
o Generalizes pointer-based joins for multi-way joins.
o Efficiently assembles complex objects (e.g., cars with components like engines and
manufacturers).
o Example:
▪ Assemble two Car objects with references to Engine and Bumper objects.
▪ Uses a window of size WWW to manage unresolved references.
▪ Steps
▪ Start with unresolved references (e.g., C1,C2 ).
▪ Resolve C1and add its references to the list (e.g., E1,B1 ).
▪ Continue resolving and assembling components until all objects in the
window are processed.
Window-based processing optimizes disk access and memory usage.
Scheduling strategies include depth-first, breadth-first, and elevator order
Distributed Assembly:
Proposed strategies:
Centralized processing: All data shipped to a central site.
Partially distributed processing: Local assembly at remote sites, with final assembly at the central
site.
Fully distributed processing: Complex operations like joins executed at remote sites, with results sent
to the central site.
Examples of Object Oriented Data Model:
Yes, web-based applications or mobile apps developed using Java or J2ME with DBMS
connectivity that retrieve image or video files from storage can follow the Object-Oriented Data
Model (OODM) if they manage data as objects.
1. Data as Objects:
o In Java, everything is treated as an object.
o Example: An Image or Video can be a class with attributes like fileName, fileSize,
fileType, and methods like play() or show().
2. Relationships and Persistence:
o Objects can have relationships, such as User having a list of Videos.
o These objects can be persisted in databases using JDBC (Java Database
Connectivity) or frameworks like Hibernate.
3. Multimedia Support:
o Image/Video Retrieval: Files can be stored in a database (BLOB/CLOB) or on a file
server.
o Example: A media app retrieving user-uploaded videos from cloud storage follows
OODM when objects like User, Video, and Playlist interact.
Real-World Example:
1. Classes/Objects:
class Video {
String title;
String filePath;
long duration;
void play() {
System.out.println("Playing " + title);
}
}
class User {
String username;
List<Video> uploadedVideos = new ArrayList<>();
• If the app only uses SQL tables and manages multimedia files separately without treating
them as objects, it follows an RDBMS model rather than OODM.
Conclusion:
• If the application uses Java’s object-oriented structure, connects to a DBMS, and treats
multimedia as objects, it follows OODM.
• If it treats multimedia as records in a 2D table and only uses SQL for queries, it follows
RDBMS.
To retrieve an image stored locally using JDBC, we can design a database-driven application that
stores the image path in a database. The application will retrieve the path using JDBC and display
the image details (file name, file size, and path).
1. Database Setup:
o Use a MySQL database.
o Create a table images to store image file paths.
C:\\Users\\91970\\Pictures\\Saved Pictures\\ram.jpg
import java.io.File;
// Constructor
public ImageFile(String imageName, String filePath) {
this.imageName = imageName;
this.filePath = filePath;
}
DatabaseConnection.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Main.java
java
Copy code
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
if (rs.next()) {
String imageName = rs.getString("image_name");
String imagePath = rs.getString("image_path");
In the context of the Object-Oriented Data Model (OODM), a Persistence Object is an object that
is designed to store and retrieve data from a persistent storage system, such as a database or file
system. These objects represent entities that can be saved beyond the runtime of an application and
retrieved later, allowing the data to persist across multiple sessions or executions.
1. Persistence:
The primary characteristic of a persistence object is its ability to store its state (data) in a
persistent storage medium, such as a relational database, NoSQL database, or file system, so
that it can be restored and accessed later.
2. Mapping between Object and Database:
These objects map directly to a database table or a file structure. Each object in an
application typically corresponds to a row in a database table or a document in a NoSQL
database.
3. Object-Relational Mapping (ORM):
In some cases, persistence objects are used with ORM tools (like Hibernate in Java, or Entity
Framework in C#) that automatically map between object-oriented models and relational
databases.
4. State Management:
Persistence objects manage the state of the data. When their state changes, the changes can be
saved to the database, and when they are retrieved, they restore their state from the database.
Let’s consider a simple User object that needs to be saved and retrieved from a database.
// Constructor
public User(int id, String name, String email) {
this.id = id;
this.name = name;
this.email = email;
}
if (rs.next()) {
return new User(rs.getInt("id"), rs.getString("name"),
rs.getString("email"));
} else {
return null;
}
}
}
}
1. User Class:
The User class is a persistence object because it represents a real-world entity that can be
stored and retrieved from a database. The class has attributes like id, name, and email that
represent a user.
2. Database Interaction:
The saveToDatabase() method saves the user object to a database, while the
getFromDatabase() method retrieves the user object based on an ID.
3. Persistence of State:
The state of the User object (name and email) is saved in the database, making it possible to
persist the data and retrieve it later.
1. Data Durability:
Without persistence objects, the application would only work with data that exists in memory
during runtime. Persistence objects allow the data to persist even after the application is
closed.
2. Data Retrieval and Manipulation:
Persistence objects can be used to manipulate and retrieve data from a storage system,
making the application more dynamic and interactive.
3. Separation of Concerns:
Persistence objects help separate the application’s logic from the data storage logic. This is
important for maintaining clean code and better management of resources.
In OODM, persistence objects typically map to real-world objects (like a User, Product, etc.) that
are persisted into a database. In a traditional RDBMS, the focus is more on tables, columns, and
rows of data. OODM focuses on objects, which can be easily transformed into database records
through techniques like Object-Relational Mapping (ORM).
Persistence Programming Languages:
OODBMS ORDBMS
Object-Oriented Database Management Object-Relational Database Management
System (OODBMS) designed to handle System (ORDBMS) designed to handle
complex data complex data
A database system that supports the creation A hybrid system combining features of both
and management of objects, similar to object- relational databases and object-oriented
oriented programming. databases.
Uses objects, classes, and inheritance from Uses tables with additional support for
object-oriented programming. complex data types such as objects and
collections.
Stores data as objects. Each object has Stores data in tables but supports objects as
attributes and methods. data types through extensions.
Uses object-oriented query languages like Uses SQL with object extensions (e.g., SQL3)
OQL (Object Query Language).
Fully supports inheritance, polymorphism, Provides limited inheritance features through
and encapsulation. table hierarchies.
Best for applications requiring complex data Suitable for traditional business applications
models, like CAD, multimedia, and scientific requiring relational structure with some object-
applications. oriented features.
No universally accepted standard exists. Well-standardized with SQL and related
extensions.
Easily integrates with object-oriented Requires mapping between objects and
languages like Java, C++, and Python. relational tables. May need additional ORM
(Object-Relational Mapping) tools.
More complex due to its object-oriented Less complex because it extends a familiar
features. relational model.
OODBMS is ideal for applications requiring ORDBMS is a practical middle-ground,
complex data modeling and direct object offering object-oriented capabilities within a
manipulation. familiar relational database framework.
Object-orineted programming (OOP) is a programming paradigm based
upon objects (having both data and methods) that aims to incorporate the
advantages of modularity and reusability. Objects, which are usually
instances of classes, are used to interact with one another to design applications
and computer programs.
What is an Object?
• Object means a real word entity such as pen, chair, table etc.
• Any entity that has state and behavior is known as an object. It can be
physical and logical. An Object is an instance of a class.
What is an Class?
• Data members are the data variables and member functions are the
functions used to manipulate these variables and together these data
members and member functions defines the properties and behavior
of the objects in a Class.
What is abstraction?
• It only indicates important things to the user and hides the internal
details, ie. While sending SMS, you just type the text and send the
message.
What is Encapsulation?
• This concept is also often used to hide the internal representation, or state,
of an object from the outside. This is called information hiding.
What is Inheritance?
Sub Class: The class that inherits properties from another class is called Sub
class or Derived Class.
Super Class: The class whose properties are inherited by sub class is called
Base Class or Super class.
The above process results in duplication of same code 3 times. This increases
the chances of error and data redundancy.
Inheritance
Using inheritance, we have to write the functions only one time instead of three
times as we have inherited rest of the three classes from base class(Vehicle).
What is polymorphism?
Polymorphism is a OOPs concept where one name can have many forms.
“Poly” means many and “morphs” means forms hence “many forms”.
Ex:
This makes data management more transparent and reduces the impedance mismatch
between the in-memory data structures of a program and the data stored on disk or in
databases.
1. Seamless Data Persistence: The language allows data structures and objects to be
stored persistently and retrieved in their original form.
4. Type Safety: Persistent languages often provide type-checking features to ensure that
the stored data matches the expected data types.
6. Lisp (Common Lisp can use external libraries for persistent storage)
Persistent programming languages help bridge the gap between in-memory data structures
and long-term data storage, streamlining development, and improving code maintainability.
Object Identity and Pointers
e.g., pointers to file system data on disk but may change if the way
data is stored in the file system is changed.
1. Give names to objects like we give names to files: works only for
small sets of objects.
Names are typically given only to class extents and other collection
objects, and perhaps to other selected objects, but most objects are not
given names.
Class extents are usually maintained for all classed that can have
persistent objects, but in many implementations, they contain only
persistent objects of the class
1. Persistent data: data that continue to exist even after the program that
created it has terminated
(1) host and DML have different type systems, code conversion
operates outside of OO type system, and hence has a higher chance
of having undetected errors
3. Drawbacks:
(1) Powerful but easy to make programming errors that damage the
database
Persistence of Objects
Simple, not flexible since it is often useful to have both transient and
persistent objects in a single class
In many OODB systems, declaring a class to be persistent is interpreted
as “persistable'' -- objects in the class potentially can be made persistent
All other objects are persistent iff they are referred, directly or indirectly,
from a root persistent object
OODBMS ORDBMS
Object-Oriented Database Management Object-Relational Database Management
System (OODBMS) designed to handle System (ORDBMS) designed to handle
complex data complex data
A database system that supports the creation A hybrid system combining features of both
and management of objects, similar to object- relational databases and object-oriented
oriented programming. databases.
Uses objects, classes, and inheritance from Uses tables with additional support for
object-oriented programming. complex data types such as objects and
collections.
Stores data as objects. Each object has Stores data in tables but supports objects as
attributes and methods. data types through extensions.
Uses object-oriented query languages like Uses SQL with object extensions (e.g., SQL3)
OQL (Object Query Language).
Fully supports inheritance, polymorphism, Provides limited inheritance features through
and encapsulation. table hierarchies.
Best for applications requiring complex data Suitable for traditional business applications
models, like CAD, multimedia, and scientific requiring relational structure with some object-
applications. oriented features.
No universally accepted standard exists. Well-standardized with SQL and related
extensions.
Easily integrates with object-oriented Requires mapping between objects and
languages like Java, C++, and Python. relational tables. May need additional ORM
(Object-Relational Mapping) tools.
More complex due to its object-oriented Less complex because it extends a familiar
features. relational model.
OODBMS is ideal for applications requiring ORDBMS is a practical middle-ground,
complex data modeling and direct object offering object-oriented capabilities within a
manipulation. familiar relational database framework.