OBJECT-ORIENTED CONCEPTS AND FEATURES
Abstraction,
encapsulation, information hiding.
Objects
and attributes.
Object
identity.
Methods
and messages.
Classes,
subclasses, super classes, and inheritance.
Overloading.
Polymorphism
and dynamic binding.
Abstraction
Process
of identifying essential aspects of an entity and ignoring unimportant
properties.
Concentrate
on what an object is and what it does, before deciding how to implement it.
Object
An
object is something uniquely identifiable, models a real-world entity and has
got state and behavior.
Resembles
entity, but object contains state and behavior and entity models only state.
Encapsulation & Information Hiding
Encapsulation
Object
contains both data structure and set of operations used to manipulate it.
Information
Hiding
Separate
external aspects of an object from its internal details, which are hidden from
outside.
Allows
internal details of an object to be changed without affecting applications that
use it, provided external details remain same.
Provides
data independence.
Attributes
Contain
current state of an object
Attributes
can be classified as simple or complex.
Simple
attribute can be a primitive type such as integer, string, etc., which takes on
literal values.
Complex
attribute can contain collections and/or references.
Reference
attribute represents relationship.
An
object that contains one or more complex attributes is called a complex object.
Object Identity
Object
Identity (OID) associated with an object on its creation:
Generated
by system.
Unique
to that object in the entire system.
Used
only by system, not by user.
Independent
of state of object
Does not change.
Object Identity - Implementation
In RDBMS OID is:
Responsibility
of the user.
Value
based.
Unique
only within table.
Key
among attributes; so is state dependent.
Can
be changed.
Using disk or RAM address is also inefficient and may cause
problems, like
They
are small
On
deletion memory can be reused that can cause problem.
Methods and Messages
Method: Implements functionality of object; is encapsulated
Message: A request to an object to execute one of its methods.
Class
A
container/template/blue-print for objects
Objects
in a class are called instances
Class
is also an object with own class attributes and class methods
Object and Class
Inheritance
Subclasses, Superclass, and Inheritance
Inheritance is a special type of relationship between classes;
The
inheriting class inherits the properties of the base class
Special
cases are subclasses and more general cases are super classes
Process
of forming a superclass is generalization; forming a subclass is specialization
Subclass
can define its own unique properties as well
Subclass can redefine inherited methods.
Overriding, Overloading, and Polymorphism
Overriding
Process of redefining a property within a subclass.
Overloading
Allows name of a method to be reused with a class or across classes.
Polymorphism
Means many forms.
Three types: Operations, inclusion, add parametric.
Complex Objects
An object that consists of sub-objects but is viewed as a single
object.
Another special type of relationship between objects, called
IS_PART_OF
Modeling Complex Object
Contained object can be encapsulated with in the complex object and
can be accessed using the methods of complex objects.
Or have its own independent existence, and only an OID is stored in
complex object.
Data Model
A structured collection of records is known as Database. The way in
which database is structured is defined as Database Model, Hierarchical model, Network
model, Object model and Relational model are some of the commonly used models
database in the structure of database.
Database Model is a
way to define the structure or logical design of a database. It tells the way
the data is stored, accessed and updated in DBMS
Hierarchical databases
A hierarchical database is a design that
uses a one-to-many relationship for data elements. Hierarchical
database models use a tree structure that links a number of disparate
elements to one "owner," or "parent," primary record.
A hierarchical database model is a data model in which the
data are organized into a tree-like structure. The data are stored as records
which are connected to one another through links. A record is a collection of
fields, with each field containing only one value.
The main characteristic of a hierarchical data
model is the treelike structure. For example, a company database might
organize using one branch for Staff, followed by Departments, Teams and then Team
Members.
Advantages: The model allows easy addition and
deletion of new information. Data at the top of the Hierarchy is
very fast to access. It was very easy to work with the model because
it worked well with linear type data storage such as tapes.
In Hierarchical database model data is
represented in a tree-like structure. It represents a parent-child relationship
with a single parent for each child. The network Model is an
extension of the Hierarchical model. In this data is
represented in the form of graphs with more than one parent node for one child
node.
A fundamental difference between segments in
a hierarchical database and tables in a relational database is
that, in a hierarchical database, segments are implicitly joined
with each other. ... In a relational database, this
relationship between tables is captured by foreign keys and
primary keys.
There are four common solutions
to get a hierarchical relation in your database:
1.
Adjacent list. Basically you add
a parent foreign key to your model.
2.
Materialized path tree. You give
every node a special “path” field.
3.
Nested sets tree. Each node gets
two numbers.
4.
Adjacent list tree with common
table expressions.
The main difference between hierarchical network and
relational database model is that hierarchical model organizes
data in a tree-like structure while network model arranges
data in a graph structure and relational database model organizes
data in tables. Database models help to create the structure
of the databases.
A hierarchical model represents the
data in a tree-like structure in which there is a single parent for each
record. To maintain order there is a sort field which keeps sibling nodes into
a recorded manner. These types of models are designed basically for the early
mainframe database management systems, like the Information Management System
(IMS) by IBM.
This model structure allows the
one-to-one and a one-to-many relationship between two/ various types of data. This
structure is very helpful in describing many relationships in the real world;
table of contents, any nested and sorted information.
The hierarchical structure is used
as the physical order of records in storage. One can access the records by
navigating down through the data structure using pointers which are combined
with sequential accessing. Therefore, the hierarchical structure is not
suitable for certain database operations when a full path is not also included
for each record.
Data in this type of database is
structured hierarchically and is typically developed as an inverted tree. The
"root" in the structure is a single table in the database and other
tables act as the branches flowing from the root. The diagram below shows a
typical hierarchical database structure.
A relationship in this database
model is represented by the term parent/child. A parent table can be linked
with one or more child tables in this type of relationship, but a single child
table can be linked with only one parent table. The tables are explicitly
linked via a pointer/index or by the physical arrangement of the records within
the tables.
28 Comments
Can you provide some details about complex objects
ReplyDeletedetail is available in this same article
DeletePurely informative
ReplyDeletevery informative, importance of using Object Oriented Database
ReplyDeleteYes
Deleteall features are amazing
ReplyDeletenovel information for me
ReplyDeleteexcellent
ReplyDeletevery informative
ReplyDeleteVery helpful
ReplyDeletevery informative
ReplyDeleteyes you are right
DeleteGood work
ReplyDeleteResearch work
ReplyDeleteVery well explained
ReplyDeleteWell written
ReplyDeleteYes
DeleteAbsolutely perfect
ReplyDeleteYes
DeleteGood work
ReplyDeleteGood work
ReplyDeleteTechnical experience
ReplyDeleteWell defined
ReplyDeleteInformative
ReplyDeleteAgreed about
ReplyDeleterendezvous
ReplyDeleteAccurate details
ReplyDeleteBest quality
ReplyDelete