| Lesson 2 || Using Oracle objects |
| Objective ||Advantages of Oracle Objects over Relational Tables |
Advantages of Oracle Objects over Relational Tables
Why should we use Oracle objects?
Select the link below if you would like to review Oracle objects.
A relational database management system (RDBMS) provides structures for storing and retrieving data;
however, the application developer must craft the operations needed for each application.
This means that you must recode the operations often, even though they may be very similar to operations that have already been coded for applications within the same enterprise. A number of significant limitations exist with the relational approach.
These include limitations in representing encapsulation
, and inheritance
Let us describe the impact of these limitations.
Bridge Oracle Objects
Drawbacks to using relational tables
Using relational tables has the following drawbacks:
- Encapsulation: Relational tables are excellent for modeling a structure of relationships. However, they fail to represent real-world objects effectively. For example, when you sell items from a pet store in the real world,
you expect to be able to sum the line items to find the total cost to the customer and perhaps to retrieve information about the customer who placed the order, such as his or her buying history and payment patterns. Relational tables do not allow you to do this.
- Composition: Relational tables cannot capture composition. For example, within a relational table, the notion of an address as a structure made up of individual columns for number, street, city, state, and zip code cannot be represented.
- Aggregation: Complex part-whole relationships cannot be represented within relational tables.
- Inheritance: Relational tables do not support inheritance, in which each "child" attribute inherits the characteristics of its parent attribute.
The bottom line is, even though Oracle RDBMS allows you to store and retrieve data, you must code the operations needed for each application. This can be avoided by using Oracle objects. In the next lesson, you will learn about the different terms for Oracle objects.
Encapsulation is the concept of information hiding. Encapsulation asserts that you can only "get at" the contents of the object using predefined functions. This allows the programmer to retain control of the data and helps reduce the impact on changes to the schema.
A composition embodies the concept of a column within a table is a combination of several composite columns. This concept cannot be handled within a relational database. In Oracle, it is possible with object types and collections such as varrays and nested table.
Aggregation occurs where one object is composed, at least in part, of other objects; you may call it a part-of relationship. A tail is a part-of a dog or a piston is a part-of an engine. This concept is implemented within collections.
Inheritance is a technique used within object-oriented development to create objects that contain generalized attributes and behavior for groups of related objects. The more general objects created using inheritance are referred to as super-types. The objects that "inherit" from the super-types (that is, they are more specific cases of the super-type) are called subtypes.