by Burleson Consulting
High Performance Data Warehousing
Database Architectures For The 1990s
Encapsulation means that each object within the system has a
well-defined interface with distinct borders. In plain English,
encapsulation refers to the "localized” variables that may be used
within an object behavior and cannot be referenced outside of that
behavior. This closely parallels the concept of information hiding.
Encapsulation also ensures that all updates to the database are
performed by using (or by way of) the behaviors associated with the
Code and data can be enclosed together into a black box, and these
"boxes" may then function independently of all other objects within
the system. (Figure 1.13) From a programming perspective, an object
is an encapsulated routine of data and behaviors. Objects may
contain public variables, which are used to handle the interfaces to
the object, and private variables, which are known only to the
object. Once created, an object is treated as a variable of its own
type. For example, an object of class car is created as a routine
with a datatype called car and is treated as a compound variable by
Figure 1.13 An example of encapsulation.
Encapsulation is used in non-database object-oriented applications
to ensure that all operations are performed through the
programmer-defined interface, and that data will never be modified
outside of the application shell. But, what about ad hoc queries and
updates? It appears that any declarative database language, such as
SQL, that allows external retrieval and update does not follow the
dictates of encapsulation and is, therefore, inconsistent with
object-oriented database management.
For example, a relational database could be defined to have a
behavior called add_line_item which serves to check inventory levels
for an item and add an item to an order only if sufficient stock is
available. This behavior ensures that orders are not entered for
out-of-stock items. However, with a language such as SQL, the
object-oriented behavior could be bypassed, and line_item records
could be added without any regard for inventory levels.
Because encapsulation and SQL are clearly incompatible, the only
conclusion that can be reached is that encapsulation may be violated
in Oracle8 by using ad hoc tools such as SQL*Plus.
This is an excerpt from "High Performance
||If you like Oracle
tuning, you may enjoy the book
Oracle Tuning: The Definitive Reference
, with over 900 pages of BC's favorite tuning tips & scripts.
can buy it directly from the publisher and save 30%, and get instant
access to the code depot of Oracle tuning scripts.