ADB - CH - 7 Object Oriented Databse

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

CHAPTER 7

Object-Oriented Databases
Object-Oriented Databases
 An object-oriented database is a collection of object-
oriented programming and relational database.
 There are various items which are created using object-
oriented programming languages like C++, Java which
can be stored in relational databases, but object-
oriented databases are well-suited for those items.
 An object-oriented database is organized around objects
rather than actions, and data rather than logic.
 For example, a multimedia record in a relational
database can be a definable data object, as opposed to
an alphanumeric value.

 Object-oriented databases add the database functionality to object programming


languages, creating more manageable code bases.
Cont`d
 When the database techniques are combined with object oriented concepts, the
result is an object oriented management system (ODBMS).
 Today’s trend in programming languages is to utilize objects, thereby making
OODBMS is ideal for Object Oriented programmers because they can develop the
product, store them as objects, and can replicate or modify existing objects to
make new objects within the OODBMS.
 Object databases based on persistent programming acquired a niche in
application areas such as engineering and spatial databases, telecommunications,
and scientific areas such as high energy physics and molecular biology.
Object-Oriented Database Systems
 The approach is heavily influenced by OO programming languages
and can be understood as an attempt to add DBMS functionality to a
programming language environment.
 The Object Database Management Group (ODMG) has developed a
standard Object Data Model (ODM) and Object Query Language
(OQL), which are the equivalent of the SQL standard for relational
database systems.
Characteristics of Object oriented databases
The characteristics of object oriented database are listed below.
 It keeps up a direct relation between real world and database objects as
if objects do not loose their integrity and identity.
 OODBs provide system generated object identifier for each object so
that an object can easily be identified and operated upon.
 OODBs are extensible, which identifies new data types and the
operations to be performed on them.
 Provides encapsulation, feature which, the data representation and the
methods implementation are hidden from external entities.
 Also provides inheritance properties in which an object inherits the
properties of other objects.
Object Database Definition
 An object database is managed by an object-oriented database
management system (OODBMS).
 The database combines object-oriented programming concepts with
relational database principles.
 Objects are the basic building block and an instance of a class, where the type
is either built-in or user-defined.
 Classes provide a schema or blueprint for objects, defining the behavior.
 Methods determine the behavior of a class.
 Pointers help access elements of an object database and establish relations
between objects
 The main characteristic of objects in OODBMS
is the possibility of user-constructed types.
 An object created in a project or application
saves into a database as is.
 Object-oriented databases directly deal with
data as complete objects.
 All the information comes in one instantly
available object package instead of multiple
tables.
 In contrast, the basic building blocks of
relational databases, such as PostgreSQL or
MySQL, are tables with actions based on
logical connections between the table data.
 These characteristics make object
databases suitable for projects with
complex data which require an object-
oriented approach to programming.
 An object-oriented management system
provides supported functionality
catered to object-oriented
programming where complex objects
are central.
 This approach unifies attributes and
behaviors of data into one entity.
Object-Oriented Programming Concepts
 Object-oriented databases closely relate to object-oriented programming
concepts. The four main ideas of object-oriented programming are:
 Polymorphism
 Inheritance
 Encapsulation
 Abstraction

 These four attributes describe the critical characteristics of object-


oriented management systems.
Polymorphism
 Polymorphism is the capability of an object to take multiple forms.
 This ability allows the same program code to work with different data
types.
 Both a car and a bike are able to break, but the mechanism is different.
 In this example, the action break is a polymorphism.
 The defined action is polymorphic — the result changes depending on
which vehicle performs.
 It allows several objects to represent to the same message in different
ways.
 In the object oriented database model, complex objects are modeled
more naturally and easily.
Inheritance
 It is the property which, when classes are arranged in a hierarchy, each class
assumes the attributes and methods of its ancestors. For example, class students are
the ancestor of undergraduate students and post graduate students.
 Inheritance creates a hierarchical relationship between related classes while making
parts of code reusable.
 Defining new types inherits all the existing class fields and methods plus further
extends them. The existing class is the parent class, while the child class extends the
parent.
 For example, a parent class called Vehicle will have child classes Car and Bike. Both
child classes inherit information from the parent class and extend the parent class
with new information depending on the vehicle type.
Encapsulation
 Encapsulation is the ability to group data and mechanisms
into a single object to provide access protection.
 Through this process, pieces of information and details of
how an object works are hidden, resulting in data and
function security.
 Classes interact with each other through methods without
the need to know how particular methods work.
 It is the property that the attributes and methods of an
object are hidden from outside world. A published interface
is used to access an object’s methods.
 As an example, a car has descriptive characteristics and actions. You can change the color
of a car, yet the model or make are examples of properties that cannot change.
 A class encapsulates all the car information into one entity, where some elements are
modifiable while some are not.
Abstraction
 Abstraction is the procedure of representing only the essential data features for
the needed functionality.
 The process selects vital information while unnecessary information stays hidden.
Abstraction helps reduce the complexity of modeled data and allows reusability.
 For example, there are different ways for a computer to connect to the network. A
web browser needs an internet connection. However, the connection type is
irrelevant.
 An established connection to the internet represents an abstraction, whereas the
various types of connections represent different implementations of the
abstraction.
UML Example for Displaying Specialization / Generalization

15
Benefit of object orientation in programming language
 The benefits of object orientation in programming language are:
 Minimizes number of lines of code
 Reduces development time
 Increases the reusability of codes
 Makes code maintenance easier
 Increased productivity of programmers
Merits of Object oriented database
OODBs provide the following merits
 OODBs allow for the storage of complex data structures that cannot
be easily stored using conventional database terminology.
 OODBs support all the persistence required for object oriented
applications.
Advantages of Object oriented data model over Relational model

When compared with the relational model, the object oriented data
model has the following advantages.
 Reusability: generic objects can be defined and then reused in
numerous application.
 Complex data types: Can manage complex data such as document,
graphics, images, voice messages, etc.
 Distributed databases: Due to mode of communication between
objects, OODBMS can support distribution of data across networks
more easily
Object oriented model vs Entity Relationship model

• An entity is simply a collection of variables or data items.


• When an application is running, the ER Model will tells how the
application’s data will be persisted but the Object Oriented Model will
decide that how that data will be stored in the memory.
Advantages of OODB over RDBMS
Object oriented database advantages over RDBMS:
• Objects do not require assembly and dis-assembly saving coding time and
execution time to assemble or disassemble objects.
• Reduced paging
• Easier navigation
• Better concurrency control
• Data model is based on the real world
• Works well for distributed architectures
• Less code required when applications are object oriented.
Object-Oriented Database Examples/Products
 There are different kinds of implementations of object databases. Most contain the
following features:
Feature Description
Language to find objects and retrieve data from the
Query Language
database.
Ability to use an object-oriented programming
Transparent Persistence
language for data manipulation.
ACID transactions guarantee all transactions are
ACID Transactions
complete without conflicting changes.
Creates a partial replica of the database.
Database Caching Allows access to a database from program
memory instead of a disk.
Disaster recovery in case of application or system
Recovery
failure
GemStone/S
 GemStone/S is an object database system based on Smalltalk – an
object-oriented programming language influenced by Java.
 developers who write applications in Smalltalk adapt easily to this
database. GemStone/S integrates seamlessly with existing Smalltalk
applications, improving speed and productivity.
 Gemstone/S is best for high-availability projects.
 There are multiple options for licensing depending on the project size.
The database server is available for various platforms, including Linux,
Windows, macOS, Solaris, AIX, as well as Raspberry Pi.
ObjectDB
 ObjectDB is a NoSQL object database for the Java programming
language. Compared to other NoSQL databases, ObjectDB is ACID
compliant. ObjectDB does not provide an API and requires using one
of the two built-in Java database APIs:
 JPA with JPA Query Language (JPQL) based on Java syntax.
 JDO with JDO Query Language (JDQL) based on SQL syntax.
 ObjectDB includes all basic data types in Java, user-de¦ned classes,
and standard Java collections.
 Every object has a unique ID. The number of elements is limited only
by the maximum database size (128 TB). ObjectDB is available cross-
platform and the benchmark performance is exceptional.
ObjectDatabase++
• is a real-time embeddable object database designed for server-side
applications. The required external maintenance is minimal.
• ObjectDatabase++ supports:
 Multi-process with multi-threaded server applications.
 Full transaction control.
 Real-time recovery.
 C++ related languages, VB.NET as well as C#.
• The object database is C++ based. One of the main features is
advanced auto-recovery from
system crashes without compromising the database integrity.
Objectivity/DB
 Objectivity/DB utilizes the power of objects and satis¦es the complex
requirements within Big Data.
 The object database is flexible by supporting multiple languages:
C++
C#
Python
Java
 The schema changes happen dynamically without the need for
odowntime, allowing real-time queries against any data type.
 bjectivity/DB is available for multiple platforms, including macOS,
Linux, Windows, or Unix
ObjectStore
 ObjectStore integrates with C++ or Java and provides memory
persistency to improve the performance of application logic. The
object database is ACID-compliant.
 The responsiveness allows developers to build distributed
applications cross-platform, whether on-premises or in the cloud.
 The main feature is cloud scalability, which allows database access
from anywhere.
 ObjectStore simplifies the data creation and exchange process
seamlessly
Versant
 Versant provides primary transparent object persistence from C++,
Java, and .NET. However, there is also support for Smalltalk and
Python.
 Versant supports different APIs depending on
the language used.
 standard SQL queries are also available, making Versant a NoSQL
database.
 The object database is a multi-user client-server database. Versant
performs best when used for online transaction systems with large
amounts of data and concurrent users
Object-Oriented Database Advantages and Disadvantages
Advantage Disadvantage
 Complex data and a wider variety  Not as widely adopted as
of data types compared to MySQL relational databases.
data types.
 No universal data model.
 Easy to save and retrieve data
quickly.  Lacks theoretical foundations
 Seamless integration with object-
and standards.
oriented programming languages.  Does not support views.
 Easier to model the advanced real High complexity causes
world problems. performance issues.
 Extensible with custom data types.  An adequate security
mechanism and access rights to
objects do not exist.
Thank you!

You might also like